title: Express.js: how to get remote client address
body: <p>I don't completely understand how I should get a remote user IP address.</p>
  
  <p>Let's say I have a simple request route such as:</p>
  
  <pre><code>app.get(/, function (req, res){
     var forwardedIpsStr = req.header('x-forwarded-for');
     var IP = '';
  
     if (forwardedIpsStr) {
        IP = forwardedIps = forwardedIpsStr.split(',')[0];  
     }
  });
  </code></pre>
  
  <p>Is the above approach correct to get the real user IP address or is there a better way?
  And what about proxies?</p>