From 2a61ec85bdaeed9a5fca2a117efb36a7f76becc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Ma=C5=82ecki?= Date: Thu, 13 Dec 2012 00:02:54 +0100 Subject: [PATCH] [fix] Handle socket errors --- lib/node-http-proxy/http-proxy.js | 6 ++++++ 1 file changed, 6 insertions(+) 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 { //