From 764505b039f6c2e6d007927d2794464d6e3c6c35 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Sat, 25 Nov 2023 13:19:29 -0800 Subject: [PATCH] sw: restore origin check Signed-off-by: Varun Patil --- src/service-worker.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/service-worker.ts b/src/service-worker.ts index 86eb4995..c35a6739 100644 --- a/src/service-worker.ts +++ b/src/service-worker.ts @@ -38,7 +38,7 @@ const cachefirst = [ // Cache static file assets registerRoute( - ({ url }) => cachefirst.some((regex) => regex.test(url.pathname)), + ({ url }) => url.origin === self.location.origin && cachefirst.some((regex) => regex.test(url.pathname)), new CacheFirst({ cacheName: 'memories-pages', plugins: [ @@ -61,7 +61,7 @@ const netonly = [ // Use NetworkFirst for HTML pages for initial state and CSRF token registerRoute( - ({ url }) => !netonly.some((regex) => regex.test(url.pathname)), + ({ url }) => url.origin === self.location.origin && !netonly.some((regex) => regex.test(url.pathname)), new NetworkFirst({ cacheName: 'memories-pages', }),