X-Forwarded-Host support

Manlio Perillo manlio_perillo at libero.it
Sun Jan 6 21:17:55 MSK 2008

Igor Sysoev ha scritto:
> On Sun, Jan 06, 2008 at 11:58:25AM +0100, Manlio Perillo wrote:
>> Igor Sysoev ha scritto:
>>> On Sat, Jan 05, 2008 at 01:06:16PM +0100, Manlio Perillo wrote:
>>>> Igor, do you plan to add support to the X-Forwarded-Host in nginx?
>>>> This can be used in the same way X-Forwarded-For is used in the realip 
>>>> module.
>>> I do not understand the X-Forwarded-Host use. The realip module is required
>>> to change IP part of HTTP request on backend side. The "Host" header line
>>> is HTTP part and it can be easy set on nginx side:
>>>       proxy_pass        http://backend1;
>>>       proxy_set_header  Host   backend2;
>>> and you do not need to do anything on backend side.
>> You are right, but for unknow (to me) reasons some people do not want to 
>> enable the
>> ProxyPreserveHost On
>> directive in Apache.
>> And, quoting from Apache documentation
>> (http://httpd.apache.org/docs/2.0/mod/mod_proxy.html):
>> This option should normally be turned Off. It is mostly useful in 
>> special configurations like proxied mass name-based virtual hosting, 
>> where the original Host header needs to be evaluated by the backend server
>> Some web applications, as an example, explicitly requires that the user 
>> set the base url so they can ignore the Host header.
> Do you mean to use X-Forwarded-Host on nginx side as ngx_http_realip_module
> does ?


It can be integrated in the ngx_http_realip_module.

I can write a new module, but adding support for X-Forwarded-Host 
requires to patch the nginx http core module.

One can also add support for the X-Forwarded-Host in the WSGI 
application, of course.

 > [...]

Regards  Manlio Perillo

More information about the nginx mailing list