mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-08 17:08:35 +08:00
fix(docker): prevent stale service worker caching (#5973)
This commit is contained in:
@@ -76,6 +76,20 @@ location ~* \.(png|jpg|jpeg|gif|ico|svg)$ {
|
|||||||
add_header Cache-Control "public, immutable";
|
add_header Cache-Control "public, immutable";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Service Worker 和 Web App Manifest 需要稳定 URL 但不能长缓存,否则前端更新时浏览器可能继续注册旧版本。
|
||||||
|
location = /service-worker.js {
|
||||||
|
expires off;
|
||||||
|
add_header Cache-Control "no-cache, must-revalidate";
|
||||||
|
try_files $uri =404;
|
||||||
|
}
|
||||||
|
|
||||||
|
location = /manifest.webmanifest {
|
||||||
|
expires off;
|
||||||
|
default_type application/manifest+json;
|
||||||
|
add_header Cache-Control "no-cache, must-revalidate";
|
||||||
|
try_files $uri =404;
|
||||||
|
}
|
||||||
|
|
||||||
# JS 和 CSS 静态资源缓存(排除 /api/v1 路径)
|
# JS 和 CSS 静态资源缓存(排除 /api/v1 路径)
|
||||||
location ~* ^/(?!api/v1).*\.(js|css)$ {
|
location ~* ^/(?!api/v1).*\.(js|css)$ {
|
||||||
try_files $uri =404;
|
try_files $uri =404;
|
||||||
@@ -86,8 +100,7 @@ location ~* ^/(?!api/v1).*\.(js|css)$ {
|
|||||||
|
|
||||||
# assets目录
|
# assets目录
|
||||||
location /assets {
|
location /assets {
|
||||||
expires 1y;
|
add_header Cache-Control "public, max-age=31536000, immutable";
|
||||||
add_header Cache-Control "public, immutable";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# 站点图标
|
# 站点图标
|
||||||
|
|||||||
Reference in New Issue
Block a user