Skip to content

Instantly share code, notes, and snippets.

@jhurliman
Created June 20, 2011 20:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jhurliman/1036434 to your computer and use it in GitHub Desktop.
Save jhurliman/1036434 to your computer and use it in GitHub Desktop.
function clientIP(req)
{
if (config.using_proxy) {
var forwardedFor = req.headers['x-forwarded-for'];
return forwardedFor ? forwardedFor : req.connection.remoteAddress;
}
return req.connection.remoteAddress;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment