Skip to content

Instantly share code, notes, and snippets.

@tlack
Created April 14, 2012 19:19
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tlack/2387185 to your computer and use it in GitHub Desktop.
Save tlack/2387185 to your computer and use it in GitHub Desktop.
express.js / node.js get remote IP address
exports.req_ip = function(req) {
return ( req.headers["X-Forwarded-For"]
|| req.headers["x-forwarded-for"]
|| req.client.remoteAddress );
}
@omkarsk98
Copy link

This does not return the public ip address of the client.
How can I find that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment