Proxyres on close and end

This commit is contained in:
Sander Declerck 2025-10-14 14:54:58 +02:00
parent a2d05b0cf0
commit ee82134c19
No known key found for this signature in database

View file

@ -30,6 +30,22 @@ export function handleHttpProxyRequest(req, res) {
// Stream error while piping response // Stream error while piping response
// Response headers already sent, can't send error status // Response headers already sent, can't send error status
}); });
proxyRes.on("close", () => {
console.log("Proxy response stream closed");
// Clean up if the proxy response stream closes
if (!res.writableEnded) {
res.end();
}
});
proxyRes.on("end", () => {
console.log("Proxy response stream ended");
// End of proxy response
if (!res.writableEnded) {
res.end();
}
});
} }
) )
.on("error", (err) => { .on("error", (err) => {