Is there any node.js module that can be used to get the public IP address of the client\'s computer making a request? I don\'t mean IPv4 or IPv6, I need the public IP like y
The next line should be enough
let ip = req.headers['x-forwarded-for'] || req.connection.remoteAddress || req.socket.remoteAddress;
If you are testing locally you will see the private IP, but if you test on the cloud the IP that you will receive is the public.
You can test it locally using ngrok
ngrok