diff --git a/lib/node-http-proxy/http-proxy.js b/lib/node-http-proxy/http-proxy.js index b026bb2..ebfd56a 100644 --- a/lib/node-http-proxy/http-proxy.js +++ b/lib/node-http-proxy/http-proxy.js @@ -314,6 +314,9 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) { // Handle 'error' events from the `reverseProxy`. // reverseProxy.once('error', proxyError); + reverseProxy.once('socket', function (socket) { + socket.once('error', proxyError); + }); // // If `req` is aborted, we abort our `reverseProxy` request as well. @@ -724,6 +727,9 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, buffer) }); reverseProxy.on('error', proxyError); + reverseProxy.once('socket', function (socket) { + socket.once('error', proxyError); + }); try { //