update
This commit is contained in:
@@ -43,9 +43,14 @@ self.addEventListener('activate', (event) => {
|
|||||||
|
|
||||||
self.addEventListener('fetch', (event) => {
|
self.addEventListener('fetch', (event) => {
|
||||||
const url = event.request.url;
|
const url = event.request.url;
|
||||||
if (url.includes('/api/') || url.includes('/socket.io/') || url.includes('/manifest.json')) {
|
|
||||||
return;
|
// Only intercept same-origin requests — never intercept cross-origin calls
|
||||||
}
|
// (Firebase API, Google CDN, socket.io CDN, etc.) or specific local paths.
|
||||||
|
// Intercepting cross-origin requests causes Firebase SDK calls to return
|
||||||
|
// cached HTML, producing "unsupported MIME type" errors and breaking FCM.
|
||||||
|
if (!url.startsWith(self.location.origin)) return;
|
||||||
|
if (url.includes('/api/') || url.includes('/socket.io/') || url.includes('/manifest.json')) return;
|
||||||
|
|
||||||
event.respondWith(
|
event.respondWith(
|
||||||
fetch(event.request).catch(() => caches.match(event.request))
|
fetch(event.request).catch(() => caches.match(event.request))
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user