From 6a864f9f4736063931a0a5fab9d83973a68cf722 Mon Sep 17 00:00:00 2001 From: Asher Date: Mon, 16 Sep 2019 14:18:58 -0500 Subject: [PATCH] Make websocket upgrade check case-insensitive Fixes #925. --- doc/quickstart.md | 7 +------ src/server.ts | 2 +- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/doc/quickstart.md b/doc/quickstart.md index eb974692..b7e3afb2 100644 --- a/doc/quickstart.md +++ b/doc/quickstart.md @@ -46,13 +46,8 @@ server { RewriteRule /(.*) http://localhost:8080/$1 [P,L] ProxyRequests off - - RequestHeader set X-Forwarded-Proto https - RequestHeader set X-Forwarded-Port 443 - - ProxyPass / http://localhost:8080/ nocanon + ProxyPass / http://localhost:8080/ nocanon ProxyPassReverse / http://localhost:8080/ - ``` diff --git a/src/server.ts b/src/server.ts index 1fd57b9f..4312d36d 100644 --- a/src/server.ts +++ b/src/server.ts @@ -331,7 +331,7 @@ export abstract class Server { this.ensureGet(request); if (!this.authenticate(request)) { throw new HttpError("Unauthorized", HttpCode.Unauthorized); - } else if (request.headers.upgrade !== "websocket") { + } else if (!request.headers.upgrade || request.headers.upgrade.toLowerCase() !== "websocket") { throw new Error("HTTP/1.1 400 Bad Request"); }