Nginx Sock And Rails Envinroment Error

Eric Wong normalperson at
Wed Feb 17 18:35:19 EST 2010

Alex Barlow <alexbarlowis at> wrote:
> Fixed it!
> Rails was considering all requests to be local. As the request was
> coming from the local ip (from nginx i assume)


Good to know, I've been setting these headers for so long that it's
become second nature and I've forgotten about side effects with Rails
error messages :x

> i put these headers in nginx
>      proxy_set_header  X-Real-IP  $remote_addr;

You probably don't need X-Real-IP, actually, it's quite nginx-specific
and X-Forwarded-For covers you.

>       proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
>       proxy_set_header Host $http_host;
>       proxy_redirect false

More information about the mongrel-unicorn mailing list