added error handling on http-proxy instance
This commit is contained in:
parent
78da05b630
commit
f569391cd9
|
@ -204,6 +204,13 @@ module.exports.create = function (deps, conf, greenlockMiddleware) {
|
|||
, toProxy: true
|
||||
});
|
||||
|
||||
proxy.on('error', function (err, req, res) {
|
||||
res.statusCode = 502;
|
||||
res.setHeader('Connection', 'close');
|
||||
res.setHeader('Content-Type', 'text/html');
|
||||
res.end(require('../proxy-conn').getRespBody(err, conf.debug));
|
||||
});
|
||||
|
||||
proxyServer = http.createServer(function (req, res) {
|
||||
proxy.web(req, res, req.connection.proxyOpts);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue