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
+9 -1
View File
@@ -65,6 +65,14 @@ process.on('exit', () => {
}
});
// Als root (de CI-container) draait de master als root en laat nginx de workers
// onder een andere gebruiker (www-data of nobody) draaien. Die kan de
// tijdelijke map (mode 700 van mkdtemp) niet openen en geeft overal 403. De
// workers draaien daarom ook als root. Zonder root mag de user-directive niet:
// nginx waarschuwt dan dat hij alleen voor het hoofdproces als root zin heeft.
export const userDirective = (uid: number | undefined) =>
uid === 0 ? 'user root;\n' : '';
// nginx onder Windows wil voorwaartse slashes in de configuratie
const slashed = (path: string) => path.replace(/\\/g, '/');
@@ -113,7 +121,7 @@ export async function startNginx(options: {
);
await writeFile(
confFile,
`daemon off;
`${userDirective(process.getuid?.())}daemon off;
pid "${slashed(join(tmp, 'nginx.pid'))}";
error_log "${slashed(errorLog)}";
events {}