I have a pair of servers, one running Nginx the other Jenkins (well, and other servers for other services, but that's besides the point). These servers sit within their own subnet that normally would not be accessible from my machine. For testing purposes, these two machines both have an ip that I can access from my machine.
If I access the Jenkins server directly, everything works as I would expect. More or less a standard Jenkins installation, done so via centos package. Only slight minor modifications was using nginx on to redirect from 80 to 8080 and also having jenkins listen to /jenkins
rather than just /
; this was done via updating the config of jenkins to include --prefix=/jenkins
.
However, the idea is that these servers are only accessible through the nginx server, as this will at some point be the https endpoint, but for now, it's just http. I have setup the reverse proxy on the nginx server and it almost works perfectly. The only issue now is that when I log in or out, whilst it does work, I get taken to the wrong ip and nothing loads in my browser. ie;
- I am on
<nginx ip>:80/jenkins
- I click log in
- It attempts to take me to
<jenkins ip on wrong subnet>:80/jenkins
- I refresh and
<nginx ip>:80/jenkins
loads with me logged in - I hover over the log out button, link says
<nginx ip>:80/jenkins/logout
- I click log out
- It attempts to take me to
<jenkins ip on wrong subnet>:80/jenkins/logout
- I refresh page, and I am logged out
I can't work out why Jenkins is using this subnet ip specifically for the log in/out. I believe jenkins is using it's own tomcat instance, but I can't seem to find any installation of it on this machine. Other services that I have set up via reverse proxy have either connected or not.