diff --git a/nginx/nginx.conf b/nginx/nginx.conf index 6b0a47ed..7b54d0a0 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -283,11 +283,21 @@ http { internal; } - location ~ "(\.html|/)$" { + location ~ "/$" { include snippets/security-headers.conf; add_header Cross-Origin-Resource-Policy "same-origin" always; add_header Cache-Control "public, no-cache"; include snippets/preload.conf; + try_files ${uri}index.html @noslash; + } + + # redirect /path/ to /path if /path.html exists + location @noslash { + rewrite ^(.*)/$ $1; + if (-f $request_filename.html) { + rewrite ^(.*) $1 permanent; + } + return 404; } location = /install/web {