diff --git a/lib/node-http-proxy.js b/lib/node-http-proxy.js index 768cff8..bbb5b0f 100644 --- a/lib/node-http-proxy.js +++ b/lib/node-http-proxy.js @@ -137,7 +137,7 @@ HttpProxy.prototype = { }; // Add a listener for the connection timeout event - reverse_proxy.connection.addListener('error', error); + reverse_proxy.addListener('error', error); // Add a listener for the reverse_proxy response event reverse_proxy.addListener('response', function (response) { @@ -173,7 +173,7 @@ HttpProxy.prototype = { // At the end of the client request, we are going to stop the proxied request req.addListener('end', function () { reverse_proxy.end(); - reverse_proxy.connection.removeListener('error', error); + reverse_proxy.removeListener('error', error); }); self.unwatch(req);