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
Written by Marcel Miranda
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Coffeescript
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#