Skip to content

Commit 6686507

Browse files
authored
Merge pull request #49 from rafaeldeoliveira/handle-proxy-errors
Handle proxy errors
2 parents 3c9a3cf + 7b0bf08 commit 6686507

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)