[TT-13257] Websocket connection is not upgraded when keep-alive
is added to Connection
#6449
Labels
keep-alive
is added to Connection
#6449
Branch/Environment/Version
Describe the bug
Connection header is deleted and not upgraded even if
Upgrade
is present, but with otherConnection
likekeep-alive
:This notably affects Firefox users when trying to dial the tyk gateway.
Reproduction steps
Steps to reproduce the behavior:
Test case
Added a test at
gateway/gateway_test.go
.Via Firefox
Firefox send a
Connection: Upgrade, keep-alive
when trying to connect to a websocket (GraphQL).Actual behavior
Test panic. By applying a debug at
tyk/gateway/testutil.go
Lines 461 to 464 in 2a2a984
It prints:
Connection header has been filtered and the connection is not upgraded (conn is nil), causing a panic in the test case.
Expected behavior
Connection should be upgraded and the header should be passed.
Cause
tyk/internal/httputil/streaming.go
Lines 25 to 37 in 2a2a984
Detections of "upgrade" in "Connection" header is too strict (
!=
) and should be more flexible (not contains
).Possible solutions
Using nhooyr.io's implementation style:
Nhooyr implementation seems pretty standard while gorilla/websocket seems "home-made".
If you could please fix this as this literally block all firefox users in using WS (including GraphQL subscriptions). Thank you 🙏 .
The text was updated successfully, but these errors were encountered: