diff --git a/lib/http-proxy/passes/ws-incoming.js b/lib/http-proxy/passes/ws-incoming.js index 7673fe067..db74729b7 100644 --- a/lib/http-proxy/passes/ws-incoming.js +++ b/lib/http-proxy/passes/ws-incoming.js @@ -83,9 +83,13 @@ var passes = exports; if (head && head.length) socket.unshift(head); + var outgoing = common.setupOutgoing(options.ssl || {}, options, req); + + // Force "connection": "upgrade" in header (outgoing default to "close") + outgoing.headers.connection = 'upgrade'; var proxyReq = (~['https:', 'wss:'].indexOf(options.target.protocol) ? https : http).request( - common.setupOutgoing(options.ssl || {}, options, req) + outgoing ); // Error Handler proxyReq.on('error', onOutgoingError);