diff --git a/deploy/configs/nginx-production.conf b/deploy/configs/nginx-production.conf index 1944f8f1f..893f4072d 100644 --- a/deploy/configs/nginx-production.conf +++ b/deploy/configs/nginx-production.conf @@ -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, diff --git a/infra/docker/nginx-production.conf b/infra/docker/nginx-production.conf index c5269f003..93e45515e 100755 --- a/infra/docker/nginx-production.conf +++ b/infra/docker/nginx-production.conf @@ -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 / {