mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 20:20:49 +00:00
Subscribe to more error events to prevent the process from crashing
This commit is contained in:
parent
c284ad7ba9
commit
65c9ca62de
3 changed files with 44 additions and 12 deletions
|
|
@ -43,8 +43,13 @@ export function handleHttpProxyRequest(req, res) {
|
|||
}
|
||||
)
|
||||
.on("error", (err) => {
|
||||
res.writeHead(502);
|
||||
res.end(`Bad Gateway: ${err.message}`);
|
||||
if (!res.headersSent) {
|
||||
res.writeHead(502);
|
||||
res.end(`Bad Gateway: ${err.message}`);
|
||||
} else {
|
||||
// Headers already sent, just destroy the response
|
||||
res.destroy();
|
||||
}
|
||||
});
|
||||
|
||||
req.on("error", () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue