I want Public IP not the local network IP.
const userIP = req.ip || req.connection.remoteAddress || req.headers['x-forwarded-for'];
const userIP = req.ip || req.connection.remoteAddress || req.headers['x-forwarded-for'];
If that's not what you're asking... can you please clarify your client-server architecture (if there even is one?)
Where is Node running? Is it on an internet-facing server, acting as a backend? Or are you doing some sort of local desktop app? Is Node using its own http systems to act as a server, or is there some other web server or reverse proxy running in front of it?
Is React running on the client's browser, separate from Node altogether? Or are you using React on the backend too (like in Next or similar)?