mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
MITM handler: Close the response on server error
This commit is contained in:
parent
efb0044419
commit
bae43d0dcd
1 changed files with 6 additions and 0 deletions
|
|
@ -47,6 +47,12 @@ function createHttpsServer(hostname, isAllowed) {
|
|||
|
||||
server.on("error", (err) => {
|
||||
ui.writeError(`Safe-chain: HTTPS server error: ${err.message}`);
|
||||
if (!res.headersSent) {
|
||||
res.writeHead(502);
|
||||
res.end("Bad Gateway");
|
||||
} else if (res.writable) {
|
||||
res.destroy();
|
||||
}
|
||||
});
|
||||
|
||||
return server;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue