Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Apache: Dev
using X-Forwarded-Host as r->hostname
 

Index | Next | Previous | View Flat


chrisd at pearsoncmg

May 3, 2012, 3:57 PM


Views: 924
Permalink
using X-Forwarded-Host as r->hostname

Hi --

It's been a remarkably long time since I had anything useful
to commit, and I'm pretty rusty, so I thought I'd throw this out for
discussion as a RTC despite the CTR rules on trunk. I promise I won't
be offended if anyone says it's a stupid hack and should never be
committed, because, well, it is arguably a very stupid hack.

I've been fighting a context where I have a new server behind
an ancient internal proxy for some transitional period of time until
we can replace the proxy too. The proxy won't send Host headers (in
httpd terms, no equivalent to ProxyPreserveHost On functionality), but
it does put the originally requested Host header into X-Forwarded-Host.

On the backend, try as I might, I could not find a way to map
the X-Forwarded-Host header on top of the Host one prior to the point
where the appropriate <VirtualHost> is determined. I hoped for
some combo of mod_headers in "early" mode + mod_setenvif, but they
run in post_read_request in the opposite order from what I needed.

Hence this patch, which adds a UseCanonicalName XHost option in
which X-Forwarded-Host is checked first, and if non-blank, is used
in place of Host to determine the server name. (The Host header is
left as-is, though.)

http://people.apache.org/~chrisd/patches/use_canonical_name_xhost/use_canonical_name_xhost-trunk.patch

Even if there's a resounding chorus of "boos", perhaps posting it
here will help others facing the same problem in the future find a bit
of a workaround if they're stuck in the same situation.

Let the torches and firebrands be set alight! Cheers,

Chris.

--
GPG Key ID: 088335A9
GPG Key Fingerprint: 86CD 3297 7493 75BC F820 6715 F54F E648 0883 35A9

Subject User Time
using X-Forwarded-Host as r->hostname chrisd at pearsoncmg May 3, 2012, 3:57 PM
    Re: using X-Forwarded-Host as r->hostname i.galic at brainsware May 3, 2012, 4:14 PM
        Re: using X-Forwarded-Host as r->hostname wrowe at rowe-clan May 11, 2012, 4:06 PM
    Re: using X-Forwarded-Host as r->hostname DRuggeri at primary May 4, 2012, 3:15 PM
    Re: using X-Forwarded-Host as r->hostname wrowe at rowe-clan May 11, 2012, 4:04 PM
        Re: using X-Forwarded-Host as r->hostname chrisd at pearsoncmg May 11, 2012, 5:30 PM
            Re: using X-Forwarded-Host as r->hostname i.galic at brainsware May 12, 2012, 5:58 AM
                Re: using X-Forwarded-Host as r->hostname chrisd at pearsoncmg May 16, 2012, 4:34 PM

  Index | Next | Previous | View Flat
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.