Testing Mojolicious locally

Tags:

So you have coded your newest web system in Mojolicious and would like to test it in an environment where it "thinks" it's running on the actual webserver, even though it's still running on your machine.

Add your www.example.com entry to point to 127.0.0.1 in /etc/hosts and then redirect your localhost's port 80 to port 3000:

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

No need to run as root!