-1

I attempt to use express to obtain visitor ip address using: console.log(req.ip); I connected to ngrok tunnel on a different device and ISP to test load the page. But I am getting the result as ::1 instead of an IP address. Anyone can advise what should I do?

Jeffez
  • 1

1 Answers1

0
const clientIpAddress = String(req.headers["x-forwarded-for"] || req.connection.remoteAddress);

Ref: Express.js: how to get remote client address

geekanant
  • 41
  • 2
  • 1
    I would recommend against posting on clearly duplicate question as it only promotes people to post duplicates without any research effort.. – Anunay Sep 18 '20 at 11:33