Andreas Happe: Linux: How to forward port 3000 to port 80

November 18, 2012 in linux tech rails

Another small tip: to locally forward port 80 to port 3000 use the following Linux iptables command:

1
$ sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 3000

You can use this command to allow customers to connect to your locally run Ruby on Rails setup (as long as you have some port forwarding set up on your local router). I am using this to develop facebook open graph apps as the application URL (that is configured within facebook’s app controll page) cannot include a custom port (like 3000).

comments powered by Disqus