Skip to content
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

Redirect to www. if 404 Not Found #3035

Merged
merged 1 commit into from
Jan 29, 2021
Merged
Show file tree
Hide file tree
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
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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if the assumption that there is a www. subdomain is new - I bet not. Also, would be nice if this is configurable, as "landing page", e.g.
But I think this is fine for now, especially as we want to test if this breaks sth on staging.

}

##### 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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

cp -f /tmp/foo $i
}

Expand Down