Hide port 8383 in glassfish 3.1.2

2019-09-08 09:57发布

问题:

I am running Glassfish 3.1.2 on Linux 6 server to deploy Oracle Apex.

I want to to hide port 8383 from url (current url say : https://sd1.domain.com:8383/apex)

80 and 443 port are already assigned for another service.

So, how can I hide port 8383 from URL.

回答1:

A TCP connection is between two ip:port pairs. In case the server's port is a common one like 80/443, most browsers don't display it.

You can use a reverse proxy on port 80, that classifies incoming HTTP traffic. It could check the subdomain in the HTTP header and then forward traffic to one of the two web servers (which both listen on dedicated ports).

With nginx the config file could look like this:

server { 
  server_name sd1.domain.com;

  location / {
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_pass http://localhost:8383;
  }
}

server { 
  server_name www.domain.com;

  location / {
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_pass http://localhost:8080;
  }
}