Skip to content

Commit

Permalink
feat: handle proxy errors
Browse files Browse the repository at this point in the history
Closes DCOS-42974
  • Loading branch information
nLight committed Oct 24, 2018
1 parent 2af9dee commit 5aa9afd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/http-server.js
Expand Up @@ -107,6 +107,14 @@ function HttpServer(options) {

if (options.proxy) {
var proxy = httpProxy.createProxyServer({});
proxy.on('error', function (err) {
if (options.logFn) { // If there's a log function for requests we can log
console.info(
'Proxy Error: "%s"',
err.message
);
}
});
before.push(function (req, res) {
proxy.web(req, res, options.proxy);
});
Expand Down

0 comments on commit 5aa9afd

Please sign in to comment.