Skip to content

Commit

Permalink
fix: stripping /docs in nginx config now handles homepage
Browse files Browse the repository at this point in the history
While reviewing the new images it was noticed that the docs homepage rendered
with a 404 status code, not a 200. This fixes the nginx config edge-case
specifically related to the homepage and the dropping of `/docs` from the
request URL in nginx
  • Loading branch information
kennethkalmer committed Mar 12, 2024
1 parent c7c38f3 commit d8a7e81
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,12 @@ jobs:
printf '.'
sleep 1
done
- run:
name: Test nginx /docs rewriting
command: |
./bin/assert-success.sh /docs
./bin/assert-redirect.sh /docs/ https://localhost/docs
./bin/assert-success.sh /docs/channels
- run:
name: Smoke test quickstart redirects
command: |
Expand Down
7 changes: 4 additions & 3 deletions config/nginx.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,12 @@ http {

error_page 404 500 /404.html;

# Removes trailing slashes everywhere
# Removes trailing slashes everywhere (by redirecting)
rewrite ^/(.*)/$ <%= ENV['SKIP_HTTPS'] == 'true' ? '$scheme' : 'https' %>://$host/$1 permanent;

# Strip /docs from the requests (we build with --prefix-paths)
rewrite ^/docs/(.*)$ /$1;
# Strip /docs from the requests (we build with --prefix-paths and our files are in public/)
rewrite ^/docs/(.*)$ /$1 last;
rewrite ^/docs$ / last;

location ~* \.json$ {
more_set_headers 'Access-Control-Allow-Origin: *';
Expand Down

0 comments on commit d8a7e81

Please sign in to comment.