有一种快速检查方式,如果请求处于状态重定向(302),我使用(req,res)我使用以下方法?检查请求是否处于重定向状态
var http = require('http'),
httpProxy = require('http-proxy');
var proxy = httpProxy.createProxyServer({});
proxy.on('proxyReq', function(proxyReq, req, res, options) {
proxyReq.setHeader('X-Special-Proxy-Header', 'foobar');
});
proxy.on('proxyRes', function (proxyRes, req, res) {
console.log('RAW Response from the target', JSON.stringify(proxyRes.headers, true, 2));
});
https://github.com/nodejitsu/node-http-proxy
请您澄清一下a)您要检查302('proxyReq'或'req'?)的哪个请求,以及b)上述代码中应该发生的位置? –