[Mongrel] Nginx, Mongrel, Proxy and REMOTE_ADDR

Joey Geiger jgeiger at gmail.com
Wed Nov 1 16:02:45 EST 2006


I was able to figure it out after some file editing.

I might be a special case because I'm proxying to nginx, which in turn
proxies to mongrel.

I removed the and only the normal IP was passed.

proxy_set_header         X-Forwarded-For $proxy_add_x_forwarded_for;

On 11/1/06, Aleksandar Lazic <al-mongrelusers at none.at> wrote:
> On Mit 01.11.2006 10:26, Joey Geiger 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.
>
> I think this isn't a mongrel issue.
>
> >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;
>
> What do you get when you add this line:
>
> proxy_set_header REMOTE_ADDR        $remote_addr;
>
> More about the proxy module can you find here:
>
> http://wiki.codemongers.com/NginxHttpProxyModule
>
> >Just wondering if anyone else has run into this problem, and it's
> >possible solution.
>
> How about to ask this on nginx list, I think it *could* be the better
> list ;-)
>
> Regards
>
> Aleks
> _______________________________________________
> Mongrel-users mailing list
> Mongrel-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-users
>


More information about the Mongrel-users mailing list