Skip to content

Commit 8bfd90c

Browse files
ArGGujcrugzz
authored andcommitted
Use raw headers instead parsed.
Set-Cookie headers are parsed into single header with cookies in array. This messes up the Set-Cookie headers, because browser receives multiple Set-Cookie headers as single with cookies separted with comma.
1 parent 931f73d commit 8bfd90c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/http-proxy/passes/ws-incoming.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,10 @@ var passes = exports;
114114
if (proxyHead && proxyHead.length) proxySocket.unshift(proxyHead);
115115

116116
socket.write('HTTP/1.1 101 Switching Protocols\r\n');
117-
socket.write(Object.keys(proxyRes.headers).map(function(i) {
118-
return i + ": " + proxyRes.headers[i];
117+
socket.write(proxyRes.rawHeaders.map(function(v, i, a) {
118+
return !(i % 2) ? v + ": " + a[i+1] : null;
119+
}).filter(function (v) {
120+
return v ? true : false;
119121
}).join('\r\n') + '\r\n\r\n');
120122
proxySocket.pipe(socket).pipe(proxySocket);
121123

0 commit comments

Comments
 (0)