HTTP_X_FORWARDED_HOST breaks Apache proxying

I’m struggling trying to get radiant-0.6.1 installed in a subdirectory.
My current approach is to use an Apache proxy.

I note there are threads starting:

http://lists.radiantcms.org/pipermail/radiant/2006-September/002022.html
http://lists.radiantcms.org/pipermail/radiant/2006-September/001929.html
http://lists.radiantcms.org/pipermail/radiant/2006-November/002405.html

which indicate some other ways this might be done.

For the moment I’m trying the approach suggested in:

http://lists.radiantcms.org/pipermail/radiant/2007-January/002932.html

which is fairly clean — but I’ve found doesn’t quiet work when
browsing to /admin. I start radiant via either mongrel or webrick, and
have it listen on 127.0.0.1:3000.

The problem is that when Apache forwards the request using proxypass, it
includes the following in the HTML:


HTTP_X_FORWARDED_HOST: foo
HTTP_USER_AGENT: Wget/1.10.2 (Red Hat modified)
SCRIPT_NAME: /
SERVER_PROTOCOL: HTTP/1.1
HTTP_HOST: 127.0.0.1:3000

This triggers code in
/radiant-0.6.1/vendor/rails/actionpack/lib/action_controller/cgi_process.rb
to
prefer the host named in HTTP_X_FORWARDED_HOST

So if I go http://localhost/radiant/admin, I get a 302 redirect that
reads:

HTTP/1.1 302 Moved Temporarily
Date: Thu, 31 May 2007 20:13:11 GMT
Server: Mongrel 1.0.1
Status: 302 Found
Location: http://foo/admin/pages

Where the new location has used HTTP_X_FORWARDED_HOST instead of
HTTP_HOST.

I can’t quite figure out what the real problem is.

o Is Apache wrong in including HTTP_X_FORWARDED_HOST ?
I think that’s pretty standard fare, and I can’t see a reason for
Apache not
to include that.

o Should radiant ignore HTTP_X_FORWARDED_HOST ?
Given John L.'s comment in
http://lists.radiantcms.org/pipermail/radiant/2006-September/002024.html
I suspect this might be the right course of action.

o Is the code in action_controller/cgi_process.rb wrong in all cases?
I’m wondering if using HTTP_X_FORWARDED_HOST can ever be the
right course of action for CGI scripts?