web development

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 ;)

Bookmark and Share

Related posts:

  1. How to install cruisecontrol/phpUnderControl in Debian Etch
  2. How to install cruisecontrol/phpUnderControl in Debian Lenny

3 Comments, Comment or Ping

  1. bookmarked. How do you stop someone from going to port 8080? iptables?

    Is there any way to export html from cruisecontrol for purposes of mirroring the code coverage and all that?

  2. This is the only way I could get it to work, to just have:

    RewriteEngine on
    RewriteRule .* http://localhost:8080/ [P,L]

    When I tried your example I got ‘ProxyPreserveHost not allowed’ even though mod_proxy is enabled? Oh well

  3. Karsten Deubert

    Hey Josh, i am always using whitelisting iptables-rules, and 8080 is not open :)

    Maybe the ProxyPreserveHost is a version thing? I don’t know what version i used back then, sorry :( Does it work with ProxyPreserveHost commented out?

    You could direct your html output in your build scripts, if you want to copy/mirror it :)

Reply to “Apache, SSL and phpUnderControl”