diff --git a/lib/http-proxy/passes/web-incoming.js b/lib/http-proxy/passes/web-incoming.js index 670ac9613..cd471fcb0 100644 --- a/lib/http-proxy/passes/web-incoming.js +++ b/lib/http-proxy/passes/web-incoming.js @@ -78,7 +78,7 @@ web_o = Object.keys(web_o).map(function(pass) { (req.headers['x-forwarded-' + header] ? ',' : '') + values[header]; }); - + req.headers['x-forwarded-host'] = req.headers['host']; }, @@ -137,6 +137,12 @@ web_o = Object.keys(web_o).map(function(pass) { proxyReq.on('error', proxyError); function proxyError (err){ + if (err.code === 'ECONNRESET' && proxyReq._headers && proxyReq._headers.connection === 'close') { + // The target server has closed the connection, but since it first sent + // a 'Connection: close' header this is not an error. + return; + } + if (clb) { clb(err, req, res, options.target); } else {