From a09477301cf6d007a00d94fa5f2f55e7f81b8021 Mon Sep 17 00:00:00 2001 From: Gilad Oren Date: Tue, 12 Jun 2012 18:22:16 +0300 Subject: [PATCH 1/2] Fix connection keep-alive header --- lib/node-http-proxy/http-proxy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node-http-proxy/http-proxy.js b/lib/node-http-proxy/http-proxy.js index e4f4ae611..501269ba1 100644 --- a/lib/node-http-proxy/http-proxy.js +++ b/lib/node-http-proxy/http-proxy.js @@ -224,7 +224,7 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) { // // Process the `reverseProxy` `response` when it's received. // - if (response.headers.connection) { + if (!response.headers.connection) { if (req.headers.connection) { response.headers.connection = req.headers.connection } else { response.headers.connection = 'close' } } From 35c882d5bbf7e3c307f9dd10beac8edcf7d872e4 Mon Sep 17 00:00:00 2001 From: Gilad Oren Date: Thu, 19 Jul 2012 17:14:10 +0300 Subject: [PATCH 2/2] Copy response headers case-insensitively --- lib/node-http-proxy/http-proxy.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/node-http-proxy/http-proxy.js b/lib/node-http-proxy/http-proxy.js index 931344c6f..993536675 100644 --- a/lib/node-http-proxy/http-proxy.js +++ b/lib/node-http-proxy/http-proxy.js @@ -244,7 +244,10 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) { } // Set the headers of the client response - res.writeHead(response.statusCode, response.headers); + Object.keys(response.headers).forEach(function(key){ + res.setHeader(key, response.headers[key]); + }); + res.writeHead(response.statusCode); // If `response.statusCode === 304`: No 'data' event and no 'end' if (response.statusCode === 304) {