Reputation: 259
I have created a J2EE application that runs on GlassFish, HTTPS enabled. When the user typed http: //www.mydomain.com:8080/app, it will be redirected to https: //www.mydomain.com:8181/app/login.
However, when I see in some of the websites, it can actually redirected to something like https: //www.mydomain.com/app/login (without the HTTPS port 8181). Does this means that the server is running both HTTP and HTTPS on port 80?
How to configure this on GlassFish 3.1?
Upvotes: 8
Views: 18234
Reputation: 1813
Non-root user should not use ports below 1024. It is better to do port forwarding from 80 to 8080 and 443 (https default) to 8181.
Execute this as root:
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
Need to make this permanent:
iptables-save -c > /etc/iptables.rules
iptables-restore < /etc/iptables.rules
and call during startup, vi /etc/network/if-pre-up.d/iptablesload
#!/bin/sh
iptables-restore < /etc/iptables.rules
exit 0
Upvotes: 11
Reputation: 497
Just to give out more details on alexblum's answer, when you login into the Glassfish Admin panel, go to Configurations -> server-config -> Network Listeners in Network Config
.
Thats what worked for me anyways.
Upvotes: 3
Reputation: 2238
You can also configure it in the admin web gui under:
Configuration -> Server Config -> Network Config -> Network Listeners
Upvotes: 4
Reputation: 10526
The default port for HTTP is 80. When you access a URL: http://www.example.com/ you are connecting to www.example.com:80
.
The default port for HTTPS is 443. When you access a URL: https://www.example.com/ you are connecting to www.example.com:443
.
(See List of port numbers)
(See configuration of GlassFish to use other ports)
Upvotes: 2