I have set up apache to work as a reverse proxy to tomcat that is running jenkins-CI. I can access the site from outside fine, except when I log in to jenkins, it redirects to my lan-hostname, and it of course it fails outside my network. After that I can manually type the original address to the browser, and it it will work fine until I have to log in again.
I wonder if this is a problem in jenkins, or in my apache/tomcat proxy setup.
Jenkins also reports on the management page that my proxy setup is not right, but does not tell any more.
Apache VirtualHost configuration:
<VirtualHost *:80>
ServerName jenkins.outsideaddress
ServerAlias ci.outsideaddress jenkins.insideaddress ci.insideaddress
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
</VirtualHost>
Also the proxy, and proxy_http modules are loaded (according to apachectl -M
)
Try to add this after ProxyPassReverse. outsideaddress is your outside FQDN.
In Jenkins, look in "Manage Jenkins" and then scroll down to the "Jenkins URL" field. Change that to jenkins.outsideaddress.
For inside access, set up your LAN DNS to resolve jenkins.outsideaddress to jenkins.insideaddress, either through a renaming or via CNAME. You can also set up a catchall on the internal addresses that will redirect to jenkins.outsideaddress.
I was finally able to fix the problem (at least I think so)!
I ran into a similar issue when trying to configure the nexus maven repository to work nicely under a similar apache httpd proxy configuration. Then I happened to ran into an issue submited to their issue tracker, where it constructed some URL's wrongly.
In the comments a suggested fix was to add
to the virtual host in httpd's conf where the other proxy configuration directives are. I no longer see the problem.