Fixes two nginx rule defects found by real nginx in CI

Plain map keys compare case-insensitively, so /Over-Mij was not redirected. A
path starting with an encoded backslash could become an open redirect through
the trailing-slash rule; it now gets the 404 page. Also makes the tests readable
for nginx's workers and less sensitive to the slow CI runner.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-01 04:47:52 +01:00
co-authored by Claude Opus 5.5
parent 95e3c61281
commit 8cb9185a69
7 changed files with 98 additions and 24 deletions
+17 -10
View File
@@ -17,16 +17,16 @@
# zijn constanten uit de paginalijst, nooit afgeleid van het verzoek.
map $uri $andreaslop_canonical {
default "";
/over-mij "";
/portfolio "";
/soorten-fotoshoots "";
/soorten-fotoshoots/newborn "";
/soorten-fotoshoots/zwangerschap "";
/soorten-fotoshoots/gezin "";
/soorten-fotoshoots/loveshoot "";
/soorten-fotoshoots/portret "";
/contact "";
/privacyverklaring "";
~^/over-mij$ "";
~^/portfolio$ "";
~^/soorten-fotoshoots$ "";
~^/soorten-fotoshoots/newborn$ "";
~^/soorten-fotoshoots/zwangerschap$ "";
~^/soorten-fotoshoots/gezin$ "";
~^/soorten-fotoshoots/loveshoot$ "";
~^/soorten-fotoshoots/portret$ "";
~^/contact$ "";
~^/privacyverklaring$ "";
~*^/index(?:\.html)?/*$ /;
~*^/over-mij(?:\.html)?/*$ /over-mij;
~*^/portfolio(?:\.html)?/*$ /portfolio;
@@ -70,6 +70,13 @@ server {
gzip_min_length 256;
gzip_types text/javascript application/javascript text/css image/svg+xml application/json text/xml application/xml text/plain;
# Een backslash vooraan zou na het weghalen van de slashes een Location
# /\host geven, en browsers lezen dat als //host. Dat pad bestaat niet
# (BR-HST-06). \x5c is de backslash; $uri is hier al gedecodeerd.
if ($uri ~ "^/\x5c") {
return 404;
}
# Alleen return in een if is veilig. Het doel komt uit de map hierboven.
if ($andreaslop_canonical) {
return 301 $andreaslop_canonical$is_args$args;