From 1843371641f5b3898893df91094412eaeedc8807 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Wed, 21 May 2025 23:45:10 +0200 Subject: 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 --- files/etc/nginx/sites-available/webmap | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'files/etc') 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; } -- cgit v1.2.3