Reputation: 21
Is there any possible way to get client public ip from api request in node js ?
From request we can get only local ip ....
Upvotes: 2
Views: 836
Reputation: 36490
In nodejs http callback:
request.socket.remoteAddress
if you have a load balancer environment:
(req.headers['x-forwarded-for'] || '').split(',')[0] || req.socket.remoteAddress
Upvotes: 1