diff --git a/lib/node-http-proxy/http-proxy.js b/lib/node-http-proxy/http-proxy.js index 7ae8b6c..9e5e545 100644 --- a/lib/node-http-proxy/http-proxy.js +++ b/lib/node-http-proxy/http-proxy.js @@ -753,9 +753,11 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, buffer) HttpProxy.prototype.close = function () { [this.forward, this.target].forEach(function (proxy) { if (proxy && proxy.agent) { - proxy.agent.sockets.forEach(function (socket) { - socket.end(); - }); + for (var host in proxy.agent.sockets) { + proxy.agent.sockets[host].forEach(function (socket) { + socket.end(); + }); + } } }); };