[Mongrel] Nginx, Mongrel, Proxy and REMOTE_ADDR
jeremy at bitsweat.net
Wed Nov 1 16:25:33 EST 2006
On 11/1/06, Joey Geiger <jgeiger at gmail.com> wrote:
> I'm using a cluster of mongrels behind an apache 1.3 proxy pass. I've
> been passing the request to pen, which in turn balances the cluster of
> mongrels. Now, I'd like to be able to use a different server to send
> the static files created by the rails application, so I tried to
> replace pen with nginx. Everything seems to work fine except the
> environment variable REMOTE_ADDR.
> 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.
> the nginx proxy information I have set is:
> proxy_redirect off;
> proxy_set_header Host $host;
> proxy_set_header X-Real-IP $remote_addr;
> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
> Just wondering if anyone else has run into this problem, and it's
> possible solution.
Use request.remote_ip which also understands the proxy headers.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Mongrel-users