fix(pwa): prevent immutable caching of /sw.js and bust SW registration to v5
This commit is contained in:
+1
-1
@@ -445,7 +445,7 @@
|
||||
<script>
|
||||
if ('serviceWorker' in navigator) {
|
||||
window.addEventListener('load', function() {
|
||||
navigator.serviceWorker.register('/sw.js', { scope: '/' })
|
||||
navigator.serviceWorker.register('/sw.js?v=5', { scope: '/' })
|
||||
.then(function(reg) {
|
||||
console.log('[Aura PWA] Service Worker registered with scope:', reg.scope);
|
||||
})
|
||||
|
||||
@@ -37,6 +37,12 @@ server {
|
||||
try_files /bimi-logo.svg =404;
|
||||
}
|
||||
|
||||
# Service Worker must never be cached as immutable
|
||||
location = /sw.js {
|
||||
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
|
||||
try_files /sw.js =404;
|
||||
}
|
||||
|
||||
# Cache other static assets
|
||||
location ~* \.(css|js|woff2?|ttf|svg|png|jpg|jpeg|ico|gif|webp)$ {
|
||||
expires 7d;
|
||||
|
||||
Reference in New Issue
Block a user