Obtenha o IP do cliente do Amazon’s EC2 ou Heroku no ExpressJS

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