httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Igor Gali? <i.ga...@brainsware.org>
Subject Re: using X-Forwarded-Host as r->hostname
Date Thu, 03 May 2012 23:14:55 GMT

----- Chris Darroch <chrisd@pearsoncmg.com> wrote:
> 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,

Wouldn't it be more appropriate to hack up^W^Wexpand mod_remoteip?

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

-- 
Igor Gali?

Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.org/
GPG: 6880 4155 74BD FD7C B515 2EA5 4B1D 9E08 A097 C9AE

Mime
View raw message