Rails and ProxyPreserveHost

22 Feb 2008

This will probably be a "duh" thing for the Apache gurus out there, but it was a learning experience for me. The other day I ran into a little Apache/Rails problem. I had a front end server running Apache, and a back end server running Apache and proxying to a Mongrel cluster. When the Rails app controller code would call do_redirect the client browser would be redirected to the back end server's hostname. The solution was two-fold:

Once those directives were in place the redirects worked as expected and all was well. Apache for the win!