diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2025-05-21 23:45:10 +0200 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2025-05-21 23:55:06 +0200 |
commit | 1843371641f5b3898893df91094412eaeedc8807 (patch) | |
tree | ccee6d658564f7a9836dfa3cb01e2b70d940aab3 /files/etc/nginx/sites-available | |
parent | b94ce2b1572a72975659e661ed9d75dbff7d2ad1 (diff) |
HTTPd: Use `Content-Type: application/x-empty` for 404 error pages.
This matches PHP's finfo_file() behavior for empty files, cf.
https://stackoverflow.com/questions/24015038/why-does-php-file-info-return-inode-x-empty-for-empty-text-files
Diffstat (limited to 'files/etc/nginx/sites-available')
-rw-r--r-- | files/etc/nginx/sites-available/webmap | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/files/etc/nginx/sites-available/webmap b/files/etc/nginx/sites-available/webmap index 6921c2c..32937fa 100644 --- a/files/etc/nginx/sites-available/webmap +++ b/files/etc/nginx/sites-available/webmap @@ -65,7 +65,8 @@ server { expires 8h; brotli_static on; try_files $uri =404; - error_page 404 /_.txt; + # service an empty payload to save bandwidth + error_page 404 /_empty; } location = /tiles/metadata.json { expires epoch; @@ -73,11 +74,12 @@ server { try_files $uri =404; } - location = /_.txt { + location = /_empty { # cache 404 responses for 8h like for valid tiles add_header Strict-Transport-Security "max-age=31557600; includeSubDomains" always; add_header Cache-Control "public; max-age=28800" always; #add_header Access-Control-Allow-Origin "*" always; + default_type application/x-empty; internal; } |