http - Node.js proxy for monitor network requests and responses -
i using nodejitsu's http proxy build tool monitor web traffic.
httpproxy.createproxyserver({ target: 'http://localhost:9000' }) .listen(8000); util.puts('proxy server listening on port 8000'); http.createserver(function targetserver(req, res) { res.writehead(302, { 'location': req.headers.host }); util.puts('request proxied to: ' + req.url + '\n' + json.stringify(req.headers, true, 2)); res.end(); }) .listen(9000); util.puts('target server listening on port 9000');
what want is
proxy outgoing requests client (browser) target server send them original destination url target server receive response on target server send response clientbasically have middleman placed between client , destination server can monitor traffic. when seek this, create 302 request, econn
error.
error: connect econnrefused @ errnoexception (net.js:901:11) @ object.afterconnect [as oncomplete] (net.js:892:19)
can help me figure out whats going on
update
i changed 302 location
argument so:
res.writehead(302, { 'location': '/' });
now, when browser tries hitting proxy server, enters redirection loop. why happening?
node.js http http-proxy node-http-proxy
No comments:
Post a Comment