Tomcat on port 80

Posted on 2007-04-07

I tried using rinetd to run Tomcat on port 80 but then you do not know the original ip address. Using iptables keeps the original IP address. The magic incantation that worked for me is (each should be a single line):

iptables -t nat -A OUTPUT -d localhost -p tcp --dport 80 -j REDIRECT --to-ports 8080
iptables -t nat -A OUTPUT -d dotted.ip.address.here -p tcp --dport 80 -j REDIRECT --to-ports 8080
iptables -t nat -A PREROUTING -d dotted.ip.address.here -p tcp --dport 80 -j REDIRECT --to-ports 8080

Tags: debian etch iptables port80 tomcat