Skip to content

Commit 6a864f9

Browse files
committed
Make websocket upgrade check case-insensitive
Fixes #925.
1 parent 5c16399 commit 6a864f9

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

doc/quickstart.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,8 @@ server {
4646
RewriteRule /(.*) http://localhost:8080/$1 [P,L]
4747
4848
ProxyRequests off
49-
50-
RequestHeader set X-Forwarded-Proto https
51-
RequestHeader set X-Forwarded-Port 443
52-
53-
ProxyPass / http://localhost:8080/ nocanon
49+
ProxyPass / http://localhost:8080/ nocanon
5450
ProxyPassReverse / http://localhost:8080/
55-
5651
</VirtualHost>
5752
```
5853

src/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ export abstract class Server {
331331
this.ensureGet(request);
332332
if (!this.authenticate(request)) {
333333
throw new HttpError("Unauthorized", HttpCode.Unauthorized);
334-
} else if (request.headers.upgrade !== "websocket") {
334+
} else if (!request.headers.upgrade || request.headers.upgrade.toLowerCase() !== "websocket") {
335335
throw new Error("HTTP/1.1 400 Bad Request");
336336
}
337337

0 commit comments

Comments
 (0)