title: get ip user with nginx and node
body: <p>I have a problem with nginx and node, because when i want get the ip of user with node, in my localhost works ok(no use nginx) but in my server dont work as it should. I was researching and see that the node no is the first that receive the ip, is nginx and after nginx send the request to node. then the ip that node receive is the my server and not user's ip.  look the the configuration server nignx:</p>
  
  <pre><code>location / {
          proxy_pass https://fotogena.co:8000;  &lt;-nginx send req to node
          proxy_http_version 1.1;
          proxy_set_header Upgrade $http_upgrade;
          proxy_set_header Connection "upgrade";
          proxy_set_header Host $host;
          proxy_connect_timeout   1000;
          proxy_send_timeout      1500;
          proxy_read_timeout      2000;
  }
  </code></pre>
  
  <p>i use "req.connection.remoteAddress" for know the ip of user and the console show me the ip of my server. somebody know how solve this problem?</p>
  
  <p>thanks :D</p>
  
  <p>-----------2016-04-20--------</p>
  
  <p>i can solved the problem, with this line on nginx file setting </p>
  
  <pre><code>proxy_set_header X-Real-IP $remote_addr;
  </code></pre>
  
  <p>and node.js</p>
  
  <pre><code>req.headers['x-forwarded-for']
  </code></pre>