How get client real IP when using nginx server in front of node as proxy How get client real IP when using nginx server in front of node as proxy express express

How get client real IP when using nginx server in front of node as proxy


In nginx if you want to pass through the IP address of the remote user to your backend web server you have to set X-Forwarded-For header to this remote ip, Like this:

proxy_set_header X-Forwarded-For $remote_addr;