How to get the real client ip for a request when tunneling with ngrok
<p>How can I make sure that the client IP address is forwarded by ngrok?</p>

<p>My test code keeps insisting that all the requests are coming from 127.0.0.1 because of ngrok but i want to log the actual client IP instead. Load balancers usually set a header in X-Forwarded-For or x-real-ip but I'm not sure what the process for ngrok is ...</p>

<pre><code>  console.log('req.headers[\'x-real-ip\']', req.headers['x-real-ip']);
  console.log('req.headers[\'X-Forwarded-For\']', req.headers['X-Forwarded-For']);
  console.log('req.ip', req.ip );
  console.log('req.connection.remoteAddress', req.connection.remoteAddress);
  console.log('req.connection.remoteAddress', req.connection.remoteAddress);
  console.log('req.socket.remoteAddress', (req.socket &amp;&amp; req.socket.remoteAddress));
  console.log('req.socket.socket.remoteAddress', (req.socket.socket &amp;&amp; req.socket.socket.remoteAddress));
</code></pre>

<p>Everything either prints <code>undefined</code> or <code>127.0.0.1</code> so far. Which means I need to configure ngrok somehow, I think.</p>