如何更新http呼叫的位置

即时通讯从以下链接使用反向代理,目前我正在获取一些位置,我想更新它(位置),我该怎么做?

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

我需要改变它,例如

res.headers.location ='http:/ c / d /'我将处理如何更改URL的逻辑,但我想知道如何更新它…

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

为了改变位置标题尝试使用res.location()

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

res.location只是设置响应头。 它没有设置响应状态码或closures响应,所以你可以写一个你想要的响应体,而且你必须在你自己之后调用res.end()

参考 : Express Location , 来源

希望这可以帮助。