diff --git a/lib/node-http-proxy/http-proxy.js b/lib/node-http-proxy/http-proxy.js index ebfd56a..1348d35 100644 --- a/lib/node-http-proxy/http-proxy.js +++ b/lib/node-http-proxy/http-proxy.js @@ -318,6 +318,11 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) { socket.once('error', proxyError); }); + // + // Handle 'error' events from the `req` (e.g. `Parse Error`). + // + req.on('error', proxyError); + // // If `req` is aborted, we abort our `reverseProxy` request as well. // @@ -731,6 +736,11 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, buffer) socket.once('error', proxyError); }); + // + // Handle 'error' events from the `req` (e.g. `Parse Error`). + // + req.on('error', proxyError); + try { // // Attempt to write the upgrade-head to the reverseProxy