From 79367c54951c40bb61f3b886a2978c0da388a4fe Mon Sep 17 00:00:00 2001 From: Gero Posmyk-Leinemann Date: Thu, 21 Sep 2023 08:44:20 +0000 Subject: [PATCH] [proxy] Re-direct mechanism controlled by env var MAINTENANCE_REDIRECT --- components/proxy/conf/Caddyfile | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/components/proxy/conf/Caddyfile b/components/proxy/conf/Caddyfile index eb8055af75c8b4..d631961d328112 100644 --- a/components/proxy/conf/Caddyfile +++ b/components/proxy/conf/Caddyfile @@ -195,6 +195,22 @@ https://{$GITPOD_DOMAIN} { import ssl_configuration import security_headers + # maintenance redirect (+ redirect away afterwards) + @maintenance_redirect { + expression `'{$MAINTENANCE_REDIRECT}' == 'true'` + not path /maintenance/* + } + handle @maintenance_redirect { + redir https://{$GITPOD_DOMAIN}/maintenance/index.html 307 + } + @maintenance_done_redirect { + expression `'{$MAINTENANCE_REDIRECT}' != 'true'` + path /maintenance/* + } + handle @maintenance_done_redirect { + redir https://{$GITPOD_DOMAIN}/workspaces permanent + } + @proxy_server_public_api path /public-api/gitpod.experimental.v1.HelloService* handle @proxy_server_public_api { uri strip_prefix /public-api