diff --git a/lib/http-proxy/passes/ws-incoming.js b/lib/http-proxy/passes/ws-incoming.js index 8264be669..1284f6443 100644 --- a/lib/http-proxy/passes/ws-incoming.js +++ b/lib/http-proxy/passes/ws-incoming.js @@ -114,8 +114,10 @@ var passes = exports; if (proxyHead && proxyHead.length) proxySocket.unshift(proxyHead); socket.write('HTTP/1.1 101 Switching Protocols\r\n'); - socket.write(Object.keys(proxyRes.headers).map(function(i) { - return i + ": " + proxyRes.headers[i]; + socket.write(proxyRes.rawHeaders.map(function(v, i, a) { + return !(i % 2) ? v + ": " + a[i+1] : null; + }).filter(function (v) { + return v ? true : false; }).join('\r\n') + '\r\n\r\n'); proxySocket.pipe(socket).pipe(proxySocket);