Skip to content

Commit 871b06f

Browse files
committed
use regex to check for upgrade header
in websocket connections
1 parent 51eeebe commit 871b06f

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/http-proxy/common.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ common.setupOutgoing = function(outgoing, options, req, forward) {
5353
if (!outgoing.agent) {
5454
outgoing.headers = outgoing.headers || {};
5555
if (typeof outgoing.headers.connection !== 'string'
56-
|| !outgoing.headers.connection.toLowerCase().split(',').some(
57-
function (s) { if (s.trim() === 'upgrade') { return true; } })
56+
|| !outgoing.headers.connection.match(/(^|,)\s*upgrade\s*($|,)/i)
5857
) { outgoing.headers.connection = 'close'; }
5958
}
6059

0 commit comments

Comments
 (0)