From df387788753f257dd4a124e6627e6097ebc19331 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=89=8D=E7=AB=AFAgent?= Date: Sat, 1 Aug 2026 18:19:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=A6=81=E6=AD=A2=E6=B5=8F=E8=A7=88?= =?UTF-8?q?=E5=99=A8=E7=BC=93=E5=AD=98=20index.html=EF=BC=8C=E9=98=B2?= =?UTF-8?q?=E6=AD=A2=E9=83=A8=E7=BD=B2=E5=90=8E=E6=97=A7=20chunk=20?= =?UTF-8?q?=E5=BC=95=E7=94=A8=E5=AF=BC=E8=87=B4=E7=99=BD=E5=B1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - nginx.conf 和 nginx-staging.conf 新增 location = /index.html 精确匹配块 - 设置 Cache-Control: no-cache, no-store, must-revalidate - 设置 Pragma: no-cache 和 expires 0 - 确保每次部署后浏览器获取最新的 index.html(含新 chunk hash) --- infra/docker/nginx-staging.conf | 7 +++++++ infra/docker/nginx.conf | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/infra/docker/nginx-staging.conf b/infra/docker/nginx-staging.conf index f3735ba18..d92cdb789 100755 --- a/infra/docker/nginx-staging.conf +++ b/infra/docker/nginx-staging.conf @@ -14,6 +14,13 @@ server { # SPA routing - all routes to index.html # 注意:不能加 $uri/,否则 /assets 等与构建产物目录同名的路由会被当成目录访问,返回 403 + # index.html must never be cached — it contains chunk references + 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; } diff --git a/infra/docker/nginx.conf b/infra/docker/nginx.conf index 601ebaa75..a5b581f7b 100755 --- a/infra/docker/nginx.conf +++ b/infra/docker/nginx.conf @@ -24,6 +24,13 @@ server { # SPA routing - all routes to index.html # 注意:不能加 $uri/,否则 /assets 等与构建产物目录同名的路由会被当成目录访问,返回 403 + # index.html must never be cached — it contains chunk references + 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; } -- 2.54.0