I have a Grails application deployed on glassfish on a droplet running Ubuntu Server. In order to make the domain work with the default http and https ports, I had to redirect the port 80 to 8080 and 443 to 8181 using iptables.
Unfortunately, something strange happens: on login, the username and password are correctly POST’ed by the client but they don’t reach the server application. Instead, the application redirects to the port 8181 and then everything works fine.
The problem seems therefore to be with the port forwarding somehow losing the POST parameters. I have no idea why this could happen.
Here is the script that I use to redirect the ports:
iptables -A INPUT -p tcp --dport 80 -j ACCEPT iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080 iptables -A INPUT -p tcp --dport 443 -j ACCEPT iptables -t nat -A PREROUTING -p tcp -m tcp --dport 443 -j REDIRECT --to-ports 8181
Any ideas why this happens and how I could fix it?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
Click below to sign up and get $100 of credit to try our products over 60 days!