Logaholic.de

Avatar

queer as code!

Apache, SSL and phpUnderControl

After installing phpUnderControl I wanted to use my existing apache, running with ssl, to proxy requests to the “java stuff”. After failing with various mod_proxy reverse proxying attempts I learned how to use mod_rewrite for this purpose.

ProxyPreserveHost on
RewriteEngine on

RequestHeader Set Proxy-keysize 512
RequestHeader Set Proxy-ip %{REMOTE_ADDR}e
RequestHeader Set Host example.org:443

RewriteRule ^/$ /cruisecontrol/ [R,L]

RewriteRule ^/cruisecontrol$ /cruisecontrol/ [R,L]
RewriteRule ^/cruisecontrol/(.*) http://localhost:8080/cruisecontrol/$1 [P,L]

RewriteRule ^/dashboard$ /dashboard/ [R,L]
RewriteRule ^/dashboard/(.*) http://localhost:8080/dashboard/$1 [P,L]

Unfortunately, phpUnderControl didn’t get the baseURL right with this setup. I didn’t want to dive into mod_jk yet, which I had read should also work (or be the more clean/generic solution), so i poked at the phpUnderControl code with grep. And now it just works fine.

You have to edit the files error.jsp, index.jsp, main.jsp and old_index.jsp in /opt/cruisecontrol/webapps/cruisecontrol/: Just place your https-url in the baseURL strings (https://example.org/cruisecontrol/).

The CruiseControl dashboard (/dashboard) does not need any tweaking for https.

One could even add any apache authentication module in front of phpUnderControl now ;)

Improving HTTP Authentication

Do you use HTTP Authentication anywhere in your webapplication? Today I discovered something that could also be useful for you.

The plusserver member control panel uses HTTP Authentication, and the errorpage replacement for the HTTP 401 authentication failed page (press cancel on the login) is replaced with a simple form with two elements: username and a button “receive lost password”.

This is the most useful errorpage-replacement i have ever seen yet ;) You could also add a link to a faq for common questions/problems there.

,