mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
Prevent headers to be sent twice
This commit is contained in:
parent
145798062e
commit
8332e74420
@ -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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user