[CentOS] Redirecting port 8080 to port 80 - how to add in /etc/sysconfig/iptables file?

Tue Jun 21 14:38:23 UTC 2016
Alexander Dalloz <ad+lists at uni-x.org>

Am 2016-06-21 16:24, schrieb Alexander Farber:
> Hello Gordon and others

[ ... ]

> here the problem description again:
> 
> I have Jetty running as user "nobody" at the port 8080.
> 
> I need to redirect incoming HTTP requests to port 80 to the above port.
> 
> (So I don't think I have ports backwards).
> 
> Here is my current /etc/sysconfig/iptables:
> 
> *filter
> :INPUT ACCEPT
> :OUTPUT ACCEPT
> :FORWARD ACCEPT
> -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
> -A INPUT -i lo -j ACCEPT
> -A INPUT -p icmp -m icmp --icmp-type any -j ACCEPT
> -A INPUT -p tcp -m tcp -m state --state NEW -m multiport --dports
> 25,80,443,8080 -j ACCEPT
> -A INPUT -p tcp -m tcp -m state --state NEW --dport 22 --tcp-flags
> FIN,SYN,RST,ACK SYN -m limit --limit 2/min --limit-burst 1 -j ACCEPT
> -A FORWARD -p tcp -m tcp --dst 144.76.184.154 --dport 8080 -j ACCEPT
> COMMIT
> 
> *nat
> :INPUT ACCEPT
> :OUTPUT ACCEPT
> :PREROUTING ACCEPT
> :POSTROUTING ACCEPT
> -A PREROUTING -p tcp --dst 144.76.184.154 --dport 8080 -j REDIRECT
> --to-port 80

That's not what you want and described above. What you are doing here is 
redirect traffic to destination address 144.76.184.154 on destination 
port 8080 to port 80. Instead you want to achieve that traffic destined 
to port 80 is redirected locally to port 8080 where jetty is listening.

> COMMIT

[ ... ]

> Please help
> Alex

Regards

Alexander