From 17afd421537e0851f8489d98094f8e540be24093 Mon Sep 17 00:00:00 2001 From: Chris Cinelli <chris.cinelli@formativelearning.com> Date: Sat, 19 Mar 2016 01:32:44 -0700 Subject: [PATCH] Do not send empty headers or Safari will throw a "Invalid UTF-8 sequence in header value" --- lib/http-proxy/passes/ws-incoming.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/http-proxy/passes/ws-incoming.js b/lib/http-proxy/passes/ws-incoming.js index a6ddb31..3f4ccb3 100644 --- a/lib/http-proxy/passes/ws-incoming.js +++ b/lib/http-proxy/passes/ws-incoming.js @@ -126,12 +126,12 @@ var passes = exports; var value = proxyRes.headers[key]; if (!Array.isArray(value)) { - head.push(key + ': ' + value); + if (options.forceEmptyHeaders || value) head.push(key + ': ' + value); return head; } for (var i = 0; i < value.length; i++) { - head.push(key + ': ' + value[i]); + if (options.forceEmptyHeaders || value) head.push(key + ': ' + value[i]); } return head; }, ['HTTP/1.1 101 Switching Protocols']) -- GitLab