1

I've a glassfish server that use the port 8080.

I need forward from port 80 to 8080 so I can access the content without put the :8080 port in the url.

I've tried to put a masquerade rule, add iptables rules but nothing changes...

The last iptables rule that i've tried is:

sudo iptables -t nat -A OUTPUT -d localhost -p tcp --dport 80 -j REDIRECT --to-port 8080

That come from this post Port 80 redirect does not work for localhost the problem is that nothing changes.

The version of opensuse is: 13.2

What I miss?

Andrea Catania
  • 111
  • 1
  • 3

1 Answers1

1

Try below iptables rules, it should work for you

sudo iptables -I INPUT -p tcp --dport 80 -j ACCEPT
sudo iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
sudo iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-port 8080

Also SuSEfirewall2 regenerates the iptables on each boot. So if you want to save rules then you can add "custom rules" using the file: /etc/sysconfig/scripts/SuSEfirewall2-custom

Vaibhav Panmand
  • 959
  • 5
  • 17