HTTP and HTTPS Port

I created a J2EE application that runs on GlassFish, HTTPS is enabled. When the user types in http://www.mydomain.com:8080/app, he will be redirected to https://www.mydomain.com:8181/app/login.

However, when I see on some sites, it can be redirected to something like https://www.mydomain.com/app/login (without the HTTPS port 8181). Does this mean that the server is running both HTTP and HTTPS on port 80?

How to configure this on GlassFish 3.1?

+7
source share
5 answers

A non-root user should not use ports below 1024. It is better to forward ports from 80 to 8080 and 443 (default https) to 8181.

Run 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 

It is necessary to make it permanent:

 iptables-save -c > /etc/iptables.rules iptables-restore < /etc/iptables.rules 

and a call at startup, vi / etc / network / if-preu-up.d / iptablesload

 #!/bin/sh iptables-restore < /etc/iptables.rules exit 0 
+9
source

You can also configure it in admin web gui under:
Configuration -> Server Config -> Network Config -> Network Listeners

+4
source

For more information on alexblum's answer, when logging into the Glassfish admin panel, go to Configurations -> server-config -> Network Listeners in Network Config .

  • Then click "Create" to add a new listener.
  • On the new listener page, select 80 as your port and set 0.0.0.0 as your IP address.
  • Select tcp as the transport and use http-thread-pool as the thread pool
  • Save and Restart your Glassfish instance.

That worked for me anyway.

+3
source

The default port for HTTP is 80. When you go to the URL: http://www.example.com/ , you connect to www.example.com:80 .

The default port for HTTPS is 443. When you access the URL: https://www.example.com/ , you connect to www.example.com:443 .

(see List of port numbers )

(see GlassFish configuration for using other ports )

+2
source

The default ports for http are 80.The default port for https is 443

0
source

All Articles