Skip to content

Commit 4d43d81

Browse files
committed
[fix] When client request is aborted, abort server request
1 parent 80c216d commit 4d43d81

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

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

+7
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,13 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) {
322322
//
323323
reverseProxy.once('error', proxyError);
324324

325+
//
326+
// If `req` is aborted, we abort our `reverseProxy` request as well.
327+
//
328+
req.on('aborted', function () {
329+
reverseProxy.abort();
330+
});
331+
325332
//
326333
// For each data `chunk` received from the incoming
327334
// `req` write it to the `reverseProxy` request.

0 commit comments

Comments
 (0)