public
Created — forked from lzyy/gist:917307

node js get client ip

  • Download Gist
gistfile1.js
JavaScript
1 2 3
function getClientAddress(req) {
return req.headers['x-forwarded-for'] || req.connection.remoteAddress;
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.