req.headers.host in Express.js returns 127.0.0.1

I am trying to get the host accessing my site in Express.js, I am using the following code

app.get('/', function(req,res){
    console.log(req.headers.host)
});

Although this code returns 127.0.0.1:1000 which is the correct port, but it's not the external address accessing it, any reason why this happens?

Thanks

Not every client has a host name, as indicated in this other question you can try to obtain the client IP address with the following code, though:

req.headers['x-forwarded-for'] || req.connection.remoteAddress

Either you've pointed your browser directly to http://127.0.0.1:1000 or you're using a local reverse proxy. In the second case your proxy must be configured to set a proper Host header.