Thursday 20 April 2017

Override req express

I am trying to override req but it seems to not work

for example

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;

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'



via ant

No comments:

Post a Comment