Project Development: How to Client IP Address in NodeJS

Friday, May 30, 2014

How to Client IP Address in NodeJS

One single function could just solve your problem.
function getClientAddress(request) {
 with (request)
  return (headers['x-forwarded-for'] || '').split(',')[0]
    || connection.remoteAddress
}

No comments:

Post a Comment