Skip to content

Commit d637b96

Browse files
committed
Don't override connection header if Upgrading
1 parent c54278b commit d637b96

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/http-proxy/common.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,14 @@ common.setupOutgoing = function(outgoing, options, req, forward) {
4747
outgoing.localAddress = options.localAddress;
4848

4949
//
50-
// Remark: If we are false set the connection: close. This is the right thing to do
50+
// Remark: If we are false and not upgrading, set the connection: close. This is the right thing to do
5151
// as node core doesn't handle this COMPLETELY properly yet.
5252
//
5353
if(!outgoing.agent) {
5454
outgoing.headers = outgoing.headers || {};
55-
outgoing.headers.connection = 'close';
55+
if(typeof outgoing.headers.connection !== 'string' || outgoing.headers.connection.toLowerCase() !== 'upgrade') {
56+
outgoing.headers.connection = 'close';
57+
}
5658
}
5759

5860
//

0 commit comments

Comments
 (0)