Skip to content

[proxy] Pre-flight requests to server /api/* endpoints #14897

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

Merged
merged 1 commit into from
Nov 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions components/proxy/conf/Caddyfile
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,30 @@ https://{$GITPOD_DOMAIN} {
base_domain {$GITPOD_DOMAIN}
}

# note: no compression, as that breaks streaming for headless logs
forward_auth server.{$KUBE_NAMESPACE}.{$KUBE_DOMAIN}:3000 {
uri /feature-flags/slow-database
copy_headers X-Gitpod-Slow-Database
}

@slow {
header X-Gitpod-Slow-Database "true"
}

@fast {
not header X-Gitpod-Slow-Database "true"
}

uri strip_prefix /api
reverse_proxy server.{$KUBE_NAMESPACE}.{$KUBE_DOMAIN}:3000 {

reverse_proxy @fast server.{$KUBE_NAMESPACE}.{$KUBE_DOMAIN}:3000 {
import upstream_headers
import upstream_connection

# required for smooth streaming of terminal logs
flush_interval -1
}

reverse_proxy @slow slow-server.{$KUBE_NAMESPACE}.{$KUBE_DOMAIN}:3000 {
import upstream_headers
import upstream_connection

Expand Down