Skip to content
This repository was archived by the owner on May 2, 2025. It is now read-only.

conditionally destroy #10

Merged
merged 1 commit into from
Nov 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/http-proxy/passes/web-incoming.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,10 @@ module.exports = {

// Ensure we abort proxy if request is aborted
res.on('close', function () {
proxyReq.destroy();
const aborted = !res.writableFinished;
if (aborted) {
proxyReq.destroy();
}
});

// handle errors in proxy and incoming request, just like for forward proxy
Expand Down