Hi,
I'm attempting to redirect requests on port 80 to port 8080. My iptables configuration looks like this:
[root@ole ~]# cat /etc/sysconfig/iptables
# Generated by iptables-save v1.4.9 on Tue Feb 7 13:11:41 2012
*nat
:PREROUTING ACCEPT [1:272]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
-A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080
COMMIT
# Completed on Tue Feb 7 13:11:41 2012
# Generated by iptables-save v1.4.9 on Tue Feb 7 13:11:41 2012
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [1055:953017]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
# Completed on Tue Feb 7 13:11:41 2012
If I understand correctly the prerouting rule should do the trick. However requests are not getting rerouted. For example this still works:
http://localhost:8080/context/test.jsp
But this does not:
http://localhost/context/test.jsp
Any ideas?
TIA,
- Ole