apache subdomain proxy to jenkins on tomcat inserting extra directory apache subdomain proxy to jenkins on tomcat inserting extra directory apache apache

apache subdomain proxy to jenkins on tomcat inserting extra directory


This works for me:

<VirtualHost *:80>    ServerName        ci.davez0r.com    ProxyPass         /  http://localhost:8080/jenkins/    ProxyPassReverse  /  http://localhost:8080/jenkins/    ProxyRequests     Off    ProxyPreserveHost On    <Proxy http://localhost:8080/jenkins/*>        Order deny,allow        Allow from all    </Proxy>    RewriteEngine on    RewriteRule   ^/jenkins/(.+) http://%{HTTP_HOST}/$1</VirtualHost>

Adding a trailing slash after the Proxy URL resulted in an infinite loop. Then adding trailing slashes after the ProxyPass URLs made it work, but all the static content had the wrong URLs.

So I added a rewrite rule to remove the extra /jenkins/ directory that was showing up who knows why.


Tomcat is generating the redirect to what - as far as it is concerned - is the correct URL.

There are a couple of options. By far the simplest is to deploy Jenkins as the ROOT web application on Tomcat.

The trickier option is to figure out how the redirect is being passed back and add the appropriate configuration in httpd to change it. To fix all the issues you are likely to see you'll probably need some combination of mod_headers and mod_substitute.