Skip to content

Commit

Permalink
[proxy/dashboard] redirect 404 to www
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexTugarev committed Jan 29, 2021
1 parent 55dad24 commit a93897c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions chart/config/proxy/lib.locations.conf
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,19 @@ location / {
add_header "Last-Modified" "";

proxy_pass http://dashboard$request_uri;

# # Page Not Found
# Let's redirect the browser agent to the web app, if no resources are found in the locations specified here.
#
# This is derived from the issue https://github.com/gitpod-io/gitpod/issues/2659, which
# was appearently caused by Twitter's link shortening. So, if the leading www is missing
# in the URL by accident, we will redirect to the web on 404 – Not Found.
error_page 404 @error_404_dashboard;
}

location @error_404_dashboard {
return 302 https://www.${PROXY_DOMAIN}$request_uri;
}

##### Authentication
# GitHub authentication callback endpoint does not like CORS headers
Expand Down
2 changes: 1 addition & 1 deletion components/proxy/startup/nginx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ cd /etc/nginx/

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

Expand Down

0 comments on commit a93897c

Please sign in to comment.