I inherited a project at work from a previous developer who actually passed away, or I'd ask him what's up...
I have two glassfish servers running on two different machines running Ubuntu, listening on HTTP 8080 and HTTPS 8081. On both systems there's iptables entries redirecting port 80 -> 8080 and port 443 -> 8081 which seems to work. On each of them I'm running one JSF app.
On Server A, when I navigate to http://servera or http://servera:8080 or http://servera/app1 or http://servera:8080/app1, it redirects to https://servera/app1. This is good because I want to use HTTPS and I want the server to default to the web app running there.
On Server B things are a little different:
When I navigate to http://serverb, http://serverb:8080, https://serverb, or https://serverb:8081, I get redirected to http://servera (wtf?)
When I navigate to http://serverb:8080/app2 I get to app2 running on serverb. When I navigate to https://serverb:8081/app2 I get to app2 running on serverb through https.
I've compared the glassfish config between the two servers and I don't see any apparent differences between the HTTP Service or Network Config sections. I also grepped the domain.xml on serverb for "servera" and didn't find any occurences.
On serverb, using lsof -i :portnumber
I see that the only thing listening on 8080 and 8081 is my glassfish server, and nothing's listening on 80 or 443.
I'm looking for some hints on where to start troubleshooting two issues here: 1) What do I need to change in the glassfish config so that serverb redirects from http -> https just like servera does?
2) Why would serverb be redirecting to servera when I don't specify the application after the hostname in the url? Is there some config I could look to outside glassfish and iptables to understand why this is happening? Maybe something I'm missing in the glassfish config?
Ended up figuring out that on serverb there was an index.xhtml inside the glassfish domain's docroot folder (glassfish4/glassfish/domains/domain1/docroot/index.xhtml) which contained a line like :
<meta http-equiv="refresh" content="0; http://servera/app1
... and that was performing the redirect. I couldn't tell via browser but when I inspected the output of curl -v http://serverb I figured out there was an intermediate page being loaded.