From 87603e1d8a146f6bcb3033273ea10ddc9c75b917 Mon Sep 17 00:00:00 2001 From: Matt Esch Date: Wed, 6 Apr 2022 03:31:40 +0100 Subject: [PATCH] fix request abort for node 16+ --- lib/http-proxy/passes/web-incoming.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/http-proxy/passes/web-incoming.js b/lib/http-proxy/passes/web-incoming.js index 7ae735514..a5bacbe4b 100644 --- a/lib/http-proxy/passes/web-incoming.js +++ b/lib/http-proxy/passes/web-incoming.js @@ -143,8 +143,8 @@ module.exports = { } // Ensure we abort proxy if request is aborted - req.on('aborted', function () { - proxyReq.abort(); + res.on('close', function () { + proxyReq.destroy(); }); // handle errors in proxy and incoming request, just like for forward proxy