Last Updated: February 25, 2016
·
1.019K
· reaktivo

Get client IP from Amazon's EC2 or Heroku on ExpressJS

getClientIp = (req) ->
  forwardedFor = req.header 'x-forwarded-for'
  if forwardedFor
    forwardedFor.split(',').shift()
  else
    req.connection.remoteAddress