Nginx + apache : REMOTE_ADDR and REMOTE_HOST bug

Albuquerque Rui saiaman01 at gmail.com
Wed Aug 31 06:35:20 UTC 2011


2011/8/31 Jim Ohlstein <jim at ohlste.in>

> On 8/30/11 5:50 PM, Maxim Dounin wrote:
> > Hello!
> >
> > On Tue, Aug 30, 2011 at 04:17:52PM -0400, Jim Ohlstein wrote:
> >
> >> On 8/30/11 2:29 PM, Albuquerque Rui wrote:
> >
> > [...]
> >
> >>>>> Changes done, nothing changed.. Still the same problem...The fact is
> >>> that it seems mod_rpaf is working well because REMOTE_ADDR is good, but
> >>> REMOTE_HOST is not good :( :( :(
> >>
> >>
> >> I agree. It is not resolving the IP incorrectly. It is not an issue with
> >> nginx or with mod_rpaf.
> >
> > As I wrote in my original reply...
> >
> >>>     >     >     I.e. client's ip is correct, but client's hostname
> still points to
> >>>     >     >     your webserver, right?  This looks like problem in
> mod_rpaf.
> >
> > ... this is obviously a problem in mod_rpaf.  It fails to change
> > ip *before* resolving happens in Apache.  (No idea if it's actually
> > possible to implement this correctly though.)
>
> Maxim, we could argue this pedantically all night long and never agree.
> However, mod_rpaf is doing exactly what it's designed to do which is to
> report the remote IP address correctly. HostNameLookups is *not* a
> function of mod_rpaf, it is a function of Apache core.
>
> However... the function works properly in *my* testing as follows.
>
> I created a small php script as follows:
>
> <?php
>
> print ('Your IP is "'.$_SERVER['REMOTE_ADDR'].'". ');
>
> print ('Your Host is "'.$_SERVER["REMOTE_HOST"].'".');
>
> ?>
>
> I turned on "HostNameLookups" in Apache.
>
> Attached is the result.
>
> This is indeed my IP and host.
>
> Why it's not working for the OP I cannot explain, but it does seem to
> work *correctly* as does "HostNameLookups" directive.
>
>
>
>> 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 :(



> >
> > Maxim Dounin
> >
> > _______________________________________________
> > nginx mailing list
> > nginx at nginx.org
> > http://mailman.nginx.org/mailman/listinfo/nginx
>
>
> --
> Jim Ohlstein
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20110831/400bd6f9/attachment-0001.html>


More information about the nginx mailing list