How to update location for http call

Im using a reverse proxy from the following link, I am currently getting some space and I want to update it (location), How can I do this?

proxy.on('proxyRes', function (proxyRes, req, res) { res.headers.location = 'http:/a/b/' }); 

and I need to change it, for example, to be

res.headers.location = 'http: / c / d /' I will handle the logic of changing the url, but want to know how to update it ...

https://github.com/nodejitsu/node-http-proxy

+6
source share
1 answer

to change location headers try using res.location ()

 proxy.on('proxyRes', function (proxyRes, req, res) { res.location('http:/c/d/'); }); 

res.location just sets the response header. It does not set the response status code or closes the response, so you can write the body of the response you want and you need to call res.end() yourself after.

Link : Express location , source

Hope this helps.

+2
source

All Articles