1

I have an application deployed on Azure and I'm trying to get the ip address of the remote client. Unfortunately I get always a value undefined when try to call

req.ip

Do you have any idea to get the ip address?

Mazzy
  • 13,354
  • 43
  • 126
  • 207
  • Duplicate: http://stackoverflow.com/questions/8107856/how-can-i-get-the-users-ip-address-using-node-js – Rahat Mahbub Jul 20 '15 at 20:56
  • Agreed, duplicate. A hint for the future, if you can find it in express, look at the node module references, express just wraps around the request and response objects. – tsturzl Jul 20 '15 at 22:34
  • @RahatMahbub - For those that agree its a dup, please vote to close it as a dup. – jfriend00 Jul 21 '15 at 00:03

1 Answers1

1
const remoteAddress = req.headers['x-forwarded-for'] || req.connection.remoteAddress;
Nicolas Del Valle
  • 1,384
  • 15
  • 20