-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[proxy] Proxy websocket traffic to slow-server
deployment according to Sec-WebSocket-Protocol
header
#14778
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Add matchers for the `Sec-WebSocket-Protocol` header and use them in the `reverse_proxy` directives.
started the job as gitpod-build-af-proxy-to-slow-server-based-on-ws-header.4 because the annotations in the pull request description changed |
I'm going to review this PR now. @andrew-farries I think we should not re-use any of the existing headers like |
@@ -210,8 +210,21 @@ https://{$GITPOD_DOMAIN} { | |||
handle @backend_wss { | |||
gitpod.sec_websocket_key | |||
|
|||
@slow { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧡 Love this change - simply on-point 😄
I'd only suggest we user a custom header instead of the websocket one. Also, we should check this on other HTTP routes that are sent against server as well 👇 .
If we go down the route of using browser extensions to inject extra headers then we eliminate the possibility of being able to control the feature by using a feature flag. By using the
This is an advantage of using a browser extension; with the |
order gitpod.headless_log_download before rewrite | ||
order gitpod.configcat before rewrite | ||
order gitpod.sec_websocket_key before header | ||
order gitpod.cors_origin before header |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming the formatting is based on the Caddy fmt command
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/hold in case you wanna wait for Gero
Another race between tide and roboquat here 😭 |
Description
As part of #9198 we want to send a subset of websocket traffic from the dashboard to an instance of
server
that runs with a higher latency connection to the Gitpod database.This PR changes the
proxy
Caddyfile
to reverse proxy traffic to the newslow-server
deployment depending on the value of theSec-WebSocket-Protocol
header that is sent by the browser websocket client during the websocket connection handshake.#14752 demonstrates an approach that allows to selectively set the value of this header for some users, based on the value of a feature flag.
Related Issue(s)
Part of #9198
How to test
In the browser console, establish a new websocket connection to the Gitpod JSON RPC API:
The network tab should show a new websocket connection with these headers sent during the handshake:
Sending and receiving through the new connection should now incur higher than usual latency:
the network tab shows a gap of ~1s between message send and response.
Tailing the logs of pods in the
slow-server
deployment reveals that they are handling websocket traffic.Release Notes
Documentation
Werft options:
If enabled this will build
install/preview
Valid options are
all
,workspace
,webapp
,ide
,jetbrains
,vscode
,ssh