From c7a31a36f25f659e9ad7fa745a104fa993420f46 Mon Sep 17 00:00:00 2001 From: Void Agent Date: Thu, 22 Oct 2026 23:15:41 +0100 Subject: nginx: keep an explicit .txt location so /robots.txt works for curl Dropping the .txt location made the curl/wget suffix map apply to every request, so /robots.txt was looked up as /robots.txt.txt and 404'd. Keep the location, but without add_header, so mime.types and charset cover the type and the server-level security headers are still inherited. --- nginx.conf | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nginx.conf b/nginx.conf index a7e345a..d8a15ca 100644 --- a/nginx.conf +++ b/nginx.conf @@ -89,6 +89,14 @@ server { =404; } + # Direct .txt requests must bypass the curl/wget suffix map, otherwise a + # request for /robots.txt is looked up as /robots.txt.txt. No add_header + # here: mime.types supplies text/plain, `charset` supplies the charset, so + # the server-level security headers are inherited normally. + location ~* \.txt$ { + try_files $uri =404; + } + location / { try_files $uri$final_suffix -- cgit v1.2.3