After some effort, I finally got Apache with an SSL connection to correctly 
proxy to Jenkins at localhost:8080/jenkins. There were two issues:

(1) The AllowEncodedSlashes setting is not inherited by virtual hosts, and 
virtual hosts are used in many default Apache configurations, such as the 
one in Ubuntu. The workaround is to add the AllowEncodedSlashes setting 
inside a VirtualHost container (/etc/apache2/sites-available/default in 
Ubuntu). ( this text was copied from here: 
http://stackoverflow.com/questions/4390436/need-to-allow-encoded-slashes-on-apache
 ). 
An Apache bug (#46830) was opened and fixed. However, it is still an issue 
in Apache 2.4.7 on Ubuntu.

When only declared globally, Jenkins reports that the reverse proxy setup 
is broken. It might be worth mentioning this as a possible cause 
here: 
https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+says+my+reverse+proxy+setup+is+broken

(2) Some pages returned absolute links (e.g., 
"http://localhost:8080/jenkins/..."; ) rather than relative links. 
Specifically, go to Jenkins' "People" page and select a user. The user's 
icon is broken. To fix this, I added an output filter that made any 
absolute links relative.

I haven't actually add jobs yet. But, hopefully, someone will find this 
information useful :)

-- Scott

Here's my final Apache configuration file:

# The following directive is not inherited by virtual hosts and *must* 
additionally be copied to each virtual host declaration
AllowEncodedSlashes NoDecode

# Jenkins must be configured with prefix "/jenkins" and port 8080
<Proxy http://localhost:8080/jenkins*>
        Order deny,allow
        Allow from all
</Proxy>
<Location /jenkins>
        ProxyPass http://localhost:8080/jenkins nocanon
        ProxyPassReverse http://localhost:8080/jenkins
        Header edit Location ^http://([^/]+)/jenkins https://$1/jenkins

        # This fixes absolute links to http://localhost:8080/jenkins
        AddOutputFilterByType INFLATE;SUBSTITUTE;DEFLATE text/html
        Substitute "s|http://localhost:8080/|/|n"

        Order deny,allow
        Allow from all
        Require all granted
</Location>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to