Skip to content

Commit a93897c

Browse files
committed
[proxy/dashboard] redirect 404 to www
1 parent 55dad24 commit a93897c

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

chart/config/proxy/lib.locations.conf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,19 @@ location / {
4343
add_header "Last-Modified" "";
4444

4545
proxy_pass http://dashboard$request_uri;
46+
47+
# # Page Not Found
48+
# Let's redirect the browser agent to the web app, if no resources are found in the locations specified here.
49+
#
50+
# This is derived from the issue https://github.com/gitpod-io/gitpod/issues/2659, which
51+
# was appearently caused by Twitter's link shortening. So, if the leading www is missing
52+
# in the URL by accident, we will redirect to the web on 404 – Not Found.
53+
error_page 404 @error_404_dashboard;
4654
}
4755

56+
location @error_404_dashboard {
57+
return 302 https://www.${PROXY_DOMAIN}$request_uri;
58+
}
4859

4960
##### Authentication
5061
# GitHub authentication callback endpoint does not like CORS headers

components/proxy/startup/nginx.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ cd /etc/nginx/
1717

1818
replaceEnvVars() {
1919
echo "Updating $i"
20-
envsubst '$KUBE_NAMESPACE,$PROXY_DOMAIN_REGEX,$PROXY_DOMAIN_COOKIE,$NAMESERVER,$SERVER_PROXY_APIKEY' < $1 > /tmp/foo;
20+
envsubst '$KUBE_NAMESPACE,$PROXY_DOMAIN,$PROXY_DOMAIN_REGEX,$PROXY_DOMAIN_COOKIE,$NAMESERVER,$SERVER_PROXY_APIKEY' < $1 > /tmp/foo;
2121
cp -f /tmp/foo $i
2222
}
2323

0 commit comments

Comments
 (0)