From 51eeebef683f6f6daca3c8c7640064254788b49c Mon Sep 17 00:00:00 2001 From: MinRK Date: Mon, 1 Sep 2014 21:25:37 -0700 Subject: [PATCH] handle 'upgrade' in comma-separated connection header Firefox sends `keep-alive, upgrade`, not just `upgrade`, which the proxy incorrectly turned into `close` --- lib/http-proxy/common.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/http-proxy/common.js b/lib/http-proxy/common.js index d532396..bcc7b8e 100644 --- a/lib/http-proxy/common.js +++ b/lib/http-proxy/common.js @@ -53,7 +53,8 @@ common.setupOutgoing = function(outgoing, options, req, forward) { if (!outgoing.agent) { outgoing.headers = outgoing.headers || {}; if (typeof outgoing.headers.connection !== 'string' - || outgoing.headers.connection.toLowerCase() !== 'upgrade' + || !outgoing.headers.connection.toLowerCase().split(',').some( + function (s) { if (s.trim() === 'upgrade') { return true; } }) ) { outgoing.headers.connection = 'close'; } }