diff --git a/nginx.conf b/nginx.conf index 4ccccd4..f215ae8 100644 --- a/nginx.conf +++ b/nginx.conf @@ -37,8 +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 + location ~ ^/api/ { + add_header Content-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)$ { + location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|flf)$ { expires 1y; add_header Cache-Control "public, immutable"; }