diff --git a/.circleci/config.yml b/.circleci/config.yml index 38d656dad2..2722a83591 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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: | diff --git a/config/nginx.conf.erb b/config/nginx.conf.erb index ff86d157e5..2958e9c933 100644 --- a/config/nginx.conf.erb +++ b/config/nginx.conf.erb @@ -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: *';