make redirects more robust

This commit is contained in:
Daniel Micay 2021-02-14 09:48:51 -05:00
parent e5fd95c5ff
commit 08affd9558

View File

@ -120,6 +120,15 @@ http {
return 301 $1/$2;
}
if ($request_uri ~ ^(.*)/index$) {
return 301 $1/;
}
# https://www.twipu.com/GrapheneOS doesn't handle links with fragments properly
if ($request_uri ~ "^/(.*)<a href=$") {
return 301 https://grapheneos.org/$1;
}
location = /security.txt {
return 301 /.well-known/security.txt;
}
@ -212,10 +221,6 @@ http {
return 301 /;
}
location ~ "^(.*)/index$" {
return 301 $1/;
}
location ~ "\.(ico|webmanifest)$" {
include snippets/security-headers.conf;
add_header Cache-Control "public, max-age=604800";
@ -238,11 +243,6 @@ http {
add_header Cache-Control "public, max-age=1800";
}
# https://www.twipu.com/GrapheneOS doesn't handle links with fragments properly
location ~ "^/(.*)<a href=$" {
return 301 https://grapheneos.org/$1;
}
location ~ "\.(br|gz)$" {
internal;
}