[Mongrel] Nginx, Mongrel, Proxy and REMOTE_ADDR

Zed A. Shaw zedshaw at zedshaw.com
Wed Nov 1 14:48:09 EST 2006


On Wed, 1 Nov 2006 10:26:43 -0600
"Joey Geiger" <jgeiger at gmail.com> wrote:


> When I do a <%= request.env["REMOTE_ADDR"] %> with pen balancing, it
> sends in the proper (and expected) 192.168.1.21.
> 
> When nginx is the balancer, the output becomes: 192.168.1.21, 127.0.0.1.

That's odd.  I wonder if nginx is doing this as a "feature" so you know that it's really 127.0.0.1 and the other IP.  I kind of like that actually.

What you can do is turn on -B logging, then go look at log/mongrel_debug/rails.log to see what is being passed to rails.  That'll let you know if it's getting combined and where.

-- 
Zed A. Shaw, MUDCRAP-CE Master Black Belt Sifu
http://www.zedshaw.com/
http://safari.oreilly.com/0321483502 -- The Mongrel Book
http://mongrel.rubyforge.org/
http://www.lingr.com/room/3yXhqKbfPy8 -- Come get help.


More information about the Mongrel-users mailing list