fix(nginx): production 补 index.html no-cache 精确块,防旧缓存导致动态 import 失败 #2031

Merged
auto-approve-bot merged 1 commits from fix/nginx-index-nocache into develop 2026-09-24 18:47:55 +08:00
2 changed files with 13 additions and 0 deletions
+6
View File
@@ -12,6 +12,12 @@ server {
client_max_body_size 800m;
# SPA routing - index.html 禁止缓存,确保每次获取最新版本
location = /index.html {
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma "no-cache";
expires 0;
}
location / {
try_files $uri /index.html;
# HTML 文档(含 try_files 回退的 SPA 路由,如 /login /app/dashboard)一律 no-cache,
+7
View File
@@ -12,6 +12,13 @@ server {
client_max_body_size 800m;
# SPA routing - index.html 禁止缓存,确保每次获取最新版本
location = /index.html {
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma "no-cache";
expires 0;
}
# SPA routing - all routes to index.html
# 注意:不能加 $uri/,否则 /assets 等与构建产物目录同名的路由会被当成目录访问,返回 403
location / {