Answer the question
In order to leave comments, you need to log in
How to display client ip on localhost node server?
var getClientAddress = function (req) {
return (req.headers['x-forwarded-for'] || '').split(',')[0]
|| req.connection.remoteAddress;
};
app.enabled('trust proxy')
Answer the question
In order to leave comments, you need to log in
Try the "X-Forwarded-For" header case, but most likely the proxy simply does not set it, you need to configure nginx or haproxy or whatever is used there.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question