I run CruiseControl.rb for a few personal projects on a server on the home LAN. CCrb comes with its own web server running by default on port 3333, but I wanted to use my Apache server as a front-end. Doing this through mod_proxy is normally pretty easy. However, I quickly get into trouble with the absolute URLs coming from CCrb as it assumes it is running at the root URL. After some head scratching I find an environment variable for Rails called RAILS_RELATIVE_URL_ROOT, but setting it doesn’t change the URLs at all. More head scratching. I finally find the solution! Below is the necessary configuration.
Apache VirtualHost configuration
<Proxy> Order deny,allow Allow from all </Proxy> ProxyRequests off ProxyPass /cc/ http://localhost:3333/ ProxyPassReverse /cc/ http://localhost:3333/
CruiseControl.rb: config/environments/production.rb
ActionController::AbstractRequest.relative_url_root = "/cc"