Skip to content

Commit

Permalink
sw: restore origin check
Browse files Browse the repository at this point in the history
Signed-off-by: Varun Patil <[email protected]>
  • Loading branch information
pulsejet committed Nov 25, 2023
1 parent 81c8fc3 commit 764505b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/service-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand All @@ -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',
}),
Expand Down

0 comments on commit 764505b

Please sign in to comment.