This commit is contained in:
2026-03-23 17:29:57 -04:00
parent a0183458eb
commit ad67330d20

View File

@@ -43,9 +43,14 @@ self.addEventListener('activate', (event) => {
self.addEventListener('fetch', (event) => {
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(
fetch(event.request).catch(() => caches.match(event.request))
);