Created
April 14, 2012 19:19
-
-
Save tlack/2387185 to your computer and use it in GitHub Desktop.
express.js / node.js get remote IP address
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.req_ip = function(req) { | |
return ( req.headers["X-Forwarded-For"] | |
|| req.headers["x-forwarded-for"] | |
|| req.client.remoteAddress ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This does not return the public ip address of the client.
How can I find that?