title: How to get client ip from node.js express application deployed on AWS Elastic beanstalk?
body: <p>I am using <strong>elastic beanstalk</strong> with <strong>ngnix</strong> proxy server. my application code was on node.js <strong>express</strong> framework. I am trying to access client ip via following code  </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var ip = event.headers['x-forwarded-for'] || 
       event.connection.remoteAddress || 
       event.socket.remoteAddress ||
       event.connection.socket.remoteAddress;</code></pre>
  </div>
  </div>
  </p>
  
  <p>but i always getting same client ip for all incoming request. I think it will be the proxy server's ip address.   </p>
  
  <p>How to access real client address from my application??? </p>