I am trying to override req but it seems to not work
for example
app.use((req, res, next) => {
req.hostname = req.headers['x-forwarded-host'] || req.hostname;
req.test = req.headers['x-forwarded-proto'] || req.protocol;
req.protocol = req.headers['x-forwarded-proto'] || req.protocol;
console.log(req.hostname);
console.log(req.test);
console.log(req.protocol);
next();
})
If I have
x-forwarded-host = 'google.com' x-forwarded-proto = 'https'
I will have
req.hostname = '127.0.0.1'
req.test = 'https'
req.protocol = 'http'