fix: use exact match for /api/fonts location in nginx

- Changed from prefix match to exact match (location =)
- Ensures /api/fonts takes priority over other location blocks
- Removes unnecessary regex location block for API routes
This commit is contained in:
2025-11-09 15:11:29 +01:00
parent e17b8f3378
commit 40d9fb330f

View File

@@ -38,18 +38,13 @@ http {
add_header Referrer-Policy "no-referrer-when-downgrade" always;
# API routes - serve as JSON (Next.js static export creates files without extensions)
location /api/fonts {
# Use exact match to ensure this takes precedence
location = /api/fonts {
default_type application/json;
add_header Cache-Control "public, max-age=3600";
try_files /api/fonts =404;
}
location ~ ^/api/ {
default_type application/json;
add_header Cache-Control "public, max-age=3600";
try_files $uri =404;
}
# Cache static assets
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|flf)$ {
expires 1y;