#959 /admin/models 空白页修复 - nginx index.html 加 no-store 头
nginx index.html 加 Cache-Control: no-store + Pragma: no-cache + Expires: 0,强制浏览器每次拉新版 SPA. 修复 #957 修复后浏览器仍缓存旧 615 bytes nginx welcome 导致的空白页.
This commit is contained in:
1 parent
53bbbf3195
commit
45b6939ab3
2 files changed
+82
-7
No files matched your search
+12
-7
@@ -39,13 +39,9 @@ server {
|
||||
access_log /var/log/nginx/access.log;
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
|
||||
# 索引 HTML 不缓存
|
||||
location = /index.html {
|
||||
add_header Cache-Control "no-cache";
|
||||
try_files /index.html =404;
|
||||
}
|
||||
|
||||
# 静态资源永久缓存
|
||||
# 索引 HTML 不缓存 + no-store 防止浏览器缓存旧版本
|
||||
# (no-store 比 no-cache 更强,直接禁止存储)
|
||||
# 静态资源永久缓存
|
||||
location ~* \.(svg|png|jpg|jpeg|gif|ico|webp|woff2?|ttf|eot|css|js|map)$ {
|
||||
root /app/frontend/dist;
|
||||
try_files $uri =404;
|
||||
@@ -55,6 +51,12 @@ server {
|
||||
}
|
||||
|
||||
# SPA fallback (root 是必须的,否则 nginx 会用默认 /usr/share/nginx/html 给出 welcome 页)
|
||||
# 注: index.html 不缓存,确保浏览器拿到最新版 SPA(避免旧的 nginx welcome 被缓存)
|
||||
location = /index.html {
|
||||
add_header Cache-Control "no-store, no-cache, must-revalidate";
|
||||
add_header Pragma "no-cache";
|
||||
add_header Expires "0";
|
||||
}
|
||||
location / {
|
||||
root /app/frontend/dist;
|
||||
try_files $uri $uri/ /index.html;
|
||||
@@ -132,3 +134,6 @@ server {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user