Skip to content

Commit cd03a46

Browse files
Andrew Farriesroboquat
Andrew Farries
authored andcommitted
Reverse proxy by Sec-WebSocket-Protocol header
Add matchers for the `Sec-WebSocket-Protocol` header and use them in the `reverse_proxy` directives.
1 parent f025229 commit cd03a46

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

components/proxy/conf/Caddyfile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,21 @@ https://{$GITPOD_DOMAIN} {
210210
handle @backend_wss {
211211
gitpod.sec_websocket_key
212212

213+
@slow {
214+
header "Sec-WebSocket-Protocol" "slow-database"
215+
}
216+
217+
@fast {
218+
not header "Sec-WebSocket-Protocol" "slow-database"
219+
}
220+
213221
uri strip_prefix /api
214-
reverse_proxy server.{$KUBE_NAMESPACE}.{$KUBE_DOMAIN}:3000 {
222+
223+
reverse_proxy @fast server.{$KUBE_NAMESPACE}.{$KUBE_DOMAIN}:3000 {
224+
import upstream_headers
225+
}
226+
227+
reverse_proxy @slow slow-server.{$KUBE_NAMESPACE}.{$KUBE_DOMAIN}:3000 {
215228
import upstream_headers
216229
}
217230
}

0 commit comments

Comments
 (0)