fix: nginx config serving assets as text/html instead of correct MIME type
Some checks failed
Build and Deploy / build-and-deploy (push) Failing after 20s

This commit is contained in:
zyc 2026-04-04 12:58:28 +08:00
parent 5fa0af4acd
commit c885051ab3

View File

@ -24,19 +24,14 @@ server {
client_max_body_size 50m;
}
# SPA client-side routes must return index.html, not match Vite's dist/assets/ dir
location ~ ^/(assets|login|profile|admin|team)(/|$) {
try_files /index.html =404;
}
# SPA fallback
location / {
try_files $uri $uri/ /index.html;
}
# Cache static assets
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
# Cache static assets (must be before SPA fallback)
location /assets/ {
expires 30d;
add_header Cache-Control "public, immutable";
}
# SPA fallback real files served directly, all other paths return index.html
location / {
try_files $uri $uri/ /index.html;
}
}