[Mongrel] Nginx, Mongrel, Proxy and REMOTE_ADDR
jgeiger at gmail.com
Thu Nov 2 18:08:26 EST 2006
The site I work on was build about 7 years ago, using apache 1.3 and
mod_perl. The majority of the site still exists in that format. I need
to maintain the current apache 1.3edness and attempt to add new
functionality using rails.
I have http://site.com/app proxying to 127.0.0.1:8000/app (which is
nginx) which in turn proxies to mongel listening at prefix=/app. It's
a big mess, especially since I can't share the image files from the
old site that the new rails code needs to use (no sense copying them
to public, which is where config.action_controller.asset_host comes
in, though it has issues with running under a prefix...)
I switched from pen as the balancer to nginx because i believe that
mongrel was going to be serving static files created by rails, so I
wanted something in front of it that could handle that and pass the
static file back to the apache proxy.
It all seems to be working right now, fingers crossed. :)
On 11/2/06, Zed A. Shaw <zedshaw at zedshaw.com> wrote:
> On Thu, 2 Nov 2006 08:25:41 -0600
> "Joey Geiger" <jgeiger at gmail.com> wrote:
> > Whoops,
> > I removed the line below.
> > proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
> > I believe what was happening, was that apache was proxying the request
> > to nginx, and adding the x_forwarded_for as the real ip (192.168.1.21)
> > then, nginx was passing the proxy request to mongrel, and was adding
> > the ip that it was forwarding for (127.0.0.1) so the address that was
> > passed to REMOTE_ADDR ended up as 192.168.1.21, 127.0.0.1.
> Uh, why do you have apache->nginx->mongrel when you can just do nginx->mongrel instead?
> Zed A. Shaw, MUDCRAP-CE Master Black Belt Sifu
> http://safari.oreilly.com/0321483502 -- The Mongrel Book
> http://www.lingr.com/room/3yXhqKbfPy8 -- Come get help.
> Mongrel-users mailing list
> Mongrel-users at rubyforge.org
More information about the Mongrel-users