Skip to content

Commit 2a61ec8

Browse files
committed
[fix] Handle socket errors
1 parent 7bc1a62 commit 2a61ec8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/node-http-proxy/http-proxy.js

+6
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,9 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) {
314314
// Handle 'error' events from the `reverseProxy`.
315315
//
316316
reverseProxy.once('error', proxyError);
317+
reverseProxy.once('socket', function (socket) {
318+
socket.once('error', proxyError);
319+
});
317320

318321
//
319322
// If `req` is aborted, we abort our `reverseProxy` request as well.
@@ -724,6 +727,9 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, buffer)
724727
});
725728

726729
reverseProxy.on('error', proxyError);
730+
reverseProxy.once('socket', function (socket) {
731+
socket.once('error', proxyError);
732+
});
727733

728734
try {
729735
//

0 commit comments

Comments
 (0)