You want to look at X-Forwarded-For

On Mon, Mar 19, 2012 at 10:40 AM, Angelo Chen <[email protected]>wrote:

> Hi,
> my nodejs server runs behind nginx, i have setup to forward ip and
> host, but following always return 127.0.0.1, why?
>
> req.connection.remoteAddress
>
> nginx.conf:
>
> server {
>     listen       80;
>    server_name  samples.com
>
>        root   /usr/share/nginx/html;
>
>    location / {
> proxy_set_header X-Real-IP $remote_addr;
>      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
>      proxy_set_header Host $http_host;
>      proxy_set_header X-NginX-Proxy true;
>                        proxy_pass         http://127.0.0.1:3000;
>                        proxy_redirect off;
>    }
>
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>



-- 
chrisrhoden

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to