How to forward request IP from NGINX to node.js application?
This solves it taking into consideration above NGINX config.
var ip = req.headers['x-real-ip'] || req.connection.remoteAddress;
Express.js official site has this guide. Instructions:
app.set('trust proxy', true)
in js.proxy_set_header X-Forwarded-For $remote_addr
in nginx.conf- You can now read-off the client IP address from
req.ip
property