Fix web cache and service worker handoff
Build and deploy Flutter Web / build (push) Failing after 5m32s

This commit is contained in:
Ruslan Bakiev
2026-06-22 16:21:02 +07:00
parent c7c1ca62ef
commit 0a852edc35
2 changed files with 12 additions and 0 deletions
+7
View File
@@ -84,6 +84,13 @@ server {
try_files $uri =404;
}
location = /main.dart.js {
add_header Cache-Control "no-cache" always;
add_header Pragma "no-cache" always;
add_header Expires "0" always;
try_files /main.dart.js =404;
}
location ~* \.(js|mjs|wasm|json|png|jpg|jpeg|gif|webp|svg|ico|woff|woff2|ttf)$ {
add_header Cache-Control "public, max-age=31536000, immutable" always;
try_files $uri =404;
+5
View File
@@ -38,8 +38,13 @@
<script>
if ('serviceWorker' in navigator) {
var refreshing = false;
var hadServiceWorkerController = !!navigator.serviceWorker.controller;
navigator.serviceWorker.addEventListener('controllerchange', function () {
if (!hadServiceWorkerController) {
hadServiceWorkerController = true;
return;
}
if (refreshing) {
return;
}