There’s good enough documentation out there on how to put a Typo blog behind a reverse proxy, and a little bit about using mongrel’s ‘prefix’, but I didn’t find any documentation out there on combining the two.
aside: Firebug 1.1 is out, and if you are using Firefox 3, you’ll need to download it. Firebug now (maybe for a while?) has a Net tab where you can see the HTTP response and request, so no need to use a debugging proxy for simple tasks. Cool. That’s what finally helped me understand how Apache, mongrel, and Typo were interacting, so kudos to the author. Now on to the show.
To set up my personal blog at http://mcgonigle.us/bill/blog I needed to adjust Apache and typo. First Apache:
RewriteEngine On
RewriteRule ^/bill/blog$ /bill/blog/ [R,L]
RewriteRule ^/bill/blog/(.*) http://localhost:8700/bill/blog/$1 [P,L]
ProxyPassReverse /bill/blog/ http://localhost:8700/bill/blog/
in the mcgonigle.us virtual host, and then, on typo:
bin/typo config `pwd` database=postgresql port-number=1234 web-server=mongrel bind-address=127.0.0.1 url-prefix=/bill/blog
and then start typo as normal. I would have preferred to leave the url-prefix off and used a proxy rule that ended in /, but for some reason that’s not clear to me, ProxyPassReverse was not rewriting the 302’s Location: field, like it ought to be. This may be because Typo was returning relative URL’s which is not per RFC. This could be an Apache or Typo bug, but it seems to work just fine like this, so I’m tempted to leave it be.
n.b. There’s documentation out there that says that you need to use the ProxyPreserveHost On
in order to prevent invalid RSS feeds, but that doesn’t seem to be necessary at the current time.