[Mongrel] Nginx, Mongrel, Proxy and REMOTE_ADDR

Joey Geiger jgeiger at gmail.com
Wed Nov 1 11:26:43 EST 2006

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)

When nginx is the balancer, the output becomes:,

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.

Thank you.

More information about the Mongrel-users mailing list