Skip to content

Commit

Permalink
[proxy] Generate random sec-websocket-key if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
csweichel committed Jul 15, 2021
1 parent c93a9f0 commit fa39408
Show file tree
Hide file tree
Showing 3 changed files with 1,142 additions and 11 deletions.
15 changes: 4 additions & 11 deletions components/proxy/conf/Caddyfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# https://caddyserver.com/docs/caddyfile/directives#directive-order
order gitpod.cors_origin before header
order gitpod.workspace_download before redir
order gitpod.sec_websocket_key before header
}

(compression) {
Expand Down Expand Up @@ -143,22 +144,14 @@ https://{$GITPOD_DOMAIN} {
redir {http.gitpod.workspace_download_url} 303
}

@backend_wss_hdr {
header sec-websocket-key *
@backend_wss {
path /api/gitpod
}
handle @backend_wss_hdr {
uri strip_prefix /api
reverse_proxy server.{$KUBE_NAMESPACE}.{$KUBE_DOMAIN}:3000 {
import upstream_headers
}
}

@backend_wss path /api/gitpod
handle @backend_wss {
gitpod.sec_websocket_key

uri strip_prefix /api
reverse_proxy server.{$KUBE_NAMESPACE}.{$KUBE_DOMAIN}:3000 {
header_up +sec-websocket-key "bxQxhPbGKQYJK1buwLGVpg=="
import upstream_headers
}
}
Expand Down
Loading

0 comments on commit fa39408

Please sign in to comment.