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; }