diff --git a/vite-frontend/index.html b/vite-frontend/index.html index be002a4..5a1e061 100644 --- a/vite-frontend/index.html +++ b/vite-frontend/index.html @@ -2,6 +2,9 @@ + + + diff --git a/vite-frontend/nginx.conf b/vite-frontend/nginx.conf index 76e1883..366fa57 100644 --- a/vite-frontend/nginx.conf +++ b/vite-frontend/nginx.conf @@ -45,10 +45,18 @@ http { # 静态文件缓存 location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ { - expires 1y; + expires 30d; add_header Cache-Control "public, immutable"; } + # HTML 文件不缓存 + location ~* \.(?:htm|html)$ { + add_header Cache-Control "no-cache, no-store, must-revalidate"; + add_header Pragma "no-cache"; + add_header Expires "0"; + try_files $uri $uri/ /index.html; + } + # Vue Router的history模式支持 location / { try_files $uri $uri/ /index.html;