Nginx + apache : REMOTE_ADDR and REMOTE_HOST bug

Albuquerque Rui saiaman01 at gmail.com
Wed Aug 31 11:57:57 UTC 2011


2011/8/31 Gena Makhomed <gmm at csdoc.com>

> On 31.08.2011 10:03, Albuquerque Rui wrote:
>
>  While accessing the page directly from apache i've got the good
>> values too. But when i pass by nginx then apache ( mod_rpaf ) the
>> hostname is not right :(
>>
>
> in request from nginx to apache backend - you set correct
> client hostname in the X-Forwarded-Host or X-Host header?
>
> RPAFsethostname on;
>
> means what you must provide desirable client hostname:
>
> source of mod_rpaf-0.6\mod_rpaf-2.0.c
> ------------------------------**-------
>
> if (cfg->sethostname) {
>    const char *hostvalue;
>    if (hostvalue = apr_table_get(r->headers_in, "X-Forwarded-Host")) {
>        /* 2.0 proxy frontend or 1.3 => 1.3.25 proxy frontend */
>        apr_table_set(r->headers_in, "Host", apr_pstrdup(r->pool,
> hostvalue));
>        r->hostname = apr_pstrdup(r->pool, hostvalue);
>        ap_update_vhost_from_headers(**r);
>    } else if (hostvalue = apr_table_get(r->headers_in, "X-Host")) {
>        /* 1.3 proxy frontend with mod_proxy_add_forward */
>        apr_table_set(r->headers_in, "Host", apr_pstrdup(r->pool,
> hostvalue));
>        r->hostname = apr_pstrdup(r->pool, hostvalue);
>        ap_update_vhost_from_headers(**r);
>    }
> }
>
>
In fact event with RPAFsethostname on; commented, there's a problem. In this
case we are talking about client remote hostname...




> --
> Best regards,
>  Gena
>
>
> ______________________________**_________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/**mailman/listinfo/nginx<http://mailman.nginx.org/mailman/listinfo/nginx>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20110831/58545277/attachment.html>


More information about the nginx mailing list