From a81d22d73cf70e031df0a171d6709ac5cff2d9bd Mon Sep 17 00:00:00 2001 From: naumov Date: Mon, 16 Sep 2024 17:49:12 +0200 Subject: [PATCH] CB-5450 cache only images from the same origin --- webapp/packages/core-browser/src/service-worker.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/webapp/packages/core-browser/src/service-worker.ts b/webapp/packages/core-browser/src/service-worker.ts index 1f7abcbf34..4ec18d0caa 100644 --- a/webapp/packages/core-browser/src/service-worker.ts +++ b/webapp/packages/core-browser/src/service-worker.ts @@ -111,14 +111,13 @@ registerRoute( new ExpirationPlugin({ maxEntries: 1000, maxAgeSeconds: 7 * 24 * 60 * 60, - purgeOnQuotaError: true, }), ], }), ); registerRoute( - ({ request }) => request.destination === 'image', + ({ request, url }) => url.origin === window.location.origin && request.destination === 'image', new CacheFirst({ cacheName: 'images', plugins: [ @@ -128,7 +127,6 @@ registerRoute( new ExpirationPlugin({ maxEntries: 1000, maxAgeSeconds: 7 * 24 * 60 * 60, - purgeOnQuotaError: true, }), ], }),