Created by: coderarity
Fixes nodejitsu/node-http-proxy#214. This will re-emit more events from RoutingProxy so that you can listen for those events yourself. Be VERY careful for the following case, which will add a new listener for every request:
//DO NOT USE THIS CODE! IT'S BROKEN!
var httpProxy = require('http-proxy');
httpProxy.createServer(function (req, res, proxy) {
var buffer = httpProxy.buffer(req);
proxy.on('end', function() {
console.log("The request was proxied (server)");
});
proxy.proxyRequest(req, res, {
host: '127.0.0.1',
port: 8080,
buffer: buffer
});
}).listen(8000);
It would be good if we could fix this case! This is a very easy problem to run into!