Skip to content

Commit 7b0bf08

Browse files
handle proxy errors
1 parent 3c9a3cf commit 7b0bf08

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/proxy.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ function proxyHandler(req, res, configs) {
4646

4747
proxyServer.web(req, res, {
4848
target: `${protocol}://${config.target}`,
49-
});
49+
}, (e, req, res) => {
50+
console.error(`Proxy error: ${e.code}`);
51+
res.writeHead(502);
52+
res.end();
53+
});
5054
}
5155
}
5256
});

0 commit comments

Comments
 (0)