Last Updated: February 25, 2016
· jdotpy

Linux: iptables port forward to use with Vagrant.

If you are using Vagrant to host your local dev environment you might want to access your apps the way: http://yourdomain.local.

First, add this line to the host /etc/hosts file: yourdomain.local

Save the changes and then type:

$ sudo iptables -t nat -I OUTPUT -p tcp -d --dport 80 -j REDIRECT --to-ports 8080

And the trick is done.

A better alternative is to use a rack application proxy like Prax: