Using iptables to Configure HTTP and HTTPS to redirect to Glassfish 4.1 Defaults

This guide can also be used if you are not using Glassfish 4.1 . In that situation you may want to know Glassfish’s default ports and what they are used for.

Port 8080 is for HTTP protocol

Port 8181 is for HTTPS protocol

Port 4848 is for the Admin Console

Now obviously you can see the problem here. By default when I user accesses a website using HTTP they are using port 80, 443 for HTTPS.

Also, you may potentially not want the admin console to be available at all, or at certain times. In that case you would want to have two version of this file. Ensure you use chmod so that it is executable by the right person/people and not by everyone.

Warning:
This does not allow you to, for example, redirect from ports using HTTP protocol to ones using HTTPS protocols. So in this situation for example, I cannot configure port 80 to redirect to 443 or 8181 because HTTP and HTTPS protocols are different.