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
This commit is contained in:
2025-11-09 14:49:50 +01:00
parent b2d6da24aa
commit e17b8f3378

View File

@@ -37,9 +37,15 @@ http {
add_header X-XSS-Protection "1; mode=block" always; add_header X-XSS-Protection "1; mode=block" always;
add_header Referrer-Policy "no-referrer-when-downgrade" 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/ { location ~ ^/api/ {
add_header Content-Type application/json; default_type application/json;
add_header Cache-Control "public, max-age=3600"; add_header Cache-Control "public, max-age=3600";
try_files $uri =404; try_files $uri =404;
} }