I want to get the client's IP and I 'm trying with localhost (127.0.0.1 )
but I always get :: 1
i 'm trying using
app.enable('trust proxy');
app.set('trust proxy', 'loopback');
app.get('/',function(req,res){
res.send(req.ip); //I always get :: 1
// or
var ip = req.headers['x-forwarded-for'] || req.connection.remoteAddress;
res.send(ip);//I always get :: 1
});
how can get 127.0.0.1
and not :: 1
. this can be done?