"Getting a user's IP address seems pretty straightforward in Node.js,
right? [...]
var ip = req.connection.remoteAddress;
But there is a problem. If you are running your app behind Nginx or
any proxy, every single IP addresses will be 127.0.0.1 [...]
Considering that fact, here is the best way to get the IP address of a
user:
var ip = req.header('x-forwarded-for') || req.connection.remoteAddress
Now you can be sure the variable ip will catch the IP address of
the client, not your proxy's."