Skip to content

Instantly share code, notes, and snippets.

@svbaker
Created October 30, 2013 15:43
Show Gist options
  • Save svbaker/7234883 to your computer and use it in GitHub Desktop.
Save svbaker/7234883 to your computer and use it in GitHub Desktop.
Get requestor IP address in Node.js
// Get client IP address from request ----------------------
getClientAddress = function (request) {
return (request.headers['x-forwarded-for'] || '').split(',')[0]
|| request.connection.remoteAddress;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment