diff --git a/lib/node-http-proxy/http-proxy.js b/lib/node-http-proxy/http-proxy.js index 890b6b0..e4a0c86 100644 --- a/lib/node-http-proxy/http-proxy.js +++ b/lib/node-http-proxy/http-proxy.js @@ -333,10 +333,12 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) { } // Set the headers of the client response - Object.keys(response.headers).forEach(function (key) { - res.setHeader(key, response.headers[key]); - }); - res.writeHead(response.statusCode); + if (res.sentHeaders !== true) { + Object.keys(response.headers).forEach(function (key) { + res.setHeader(key, response.headers[key]); + }); + res.writeHead(response.statusCode); + } function ondata(chunk) { if (res.writable) {