From e17b8f3378e9b5b757c1fe6b53caf53dff71cf72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Kr=C3=BCger?= Date: Sun, 9 Nov 2025 14:49:50 +0100 Subject: [PATCH] fix: serve /api/fonts with correct Content-Type in production - Add specific location block for /api/fonts endpoint - Set default_type to application/json for API routes - Next.js static export creates extensionless files that need explicit Content-Type - Fixes 404 error on production deployment --- nginx.conf | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/nginx.conf b/nginx.conf index f215ae8..72b3f2f 100644 --- a/nginx.conf +++ b/nginx.conf @@ -37,9 +37,15 @@ http { add_header X-XSS-Protection "1; mode=block" always; add_header Referrer-Policy "no-referrer-when-downgrade" always; - # API routes - serve as JSON + # API routes - serve as JSON (Next.js static export creates files without extensions) + location /api/fonts { + default_type application/json; + add_header Cache-Control "public, max-age=3600"; + try_files /api/fonts =404; + } + location ~ ^/api/ { - add_header Content-Type application/json; + default_type application/json; add_header Cache-Control "public, max-age=3600"; try_files $uri =404; }