diff options
| author | Void Agent <void@jayrup.hermes> | 2026-10-22 23:15:41 +0100 |
|---|---|---|
| committer | Void Agent <void@jayrup.hermes> | 2026-10-22 23:15:41 +0100 |
| commit | c7a31a36f25f659e9ad7fa745a104fa993420f46 (patch) | |
| tree | e2a6646885792e47d2993d6a842dbe0c7f69c937 | |
| parent | 0eea672450447fc678f8073307a2e9139dd85616 (diff) | |
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.
| -rw-r--r-- | nginx.conf | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -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 |
