chore/attachments-sw-cache (#9122)

This commit is contained in:
Tom Moor
2025-05-02 22:15:39 -04:00
committed by GitHub
parent 5ebb1e8a61
commit 7bd1ea7c40
+31
View File
@@ -94,6 +94,9 @@ export default () =>
modifyURLPrefix: {
"": `${environment.CDN_URL ?? ""}/static/`,
},
skipWaiting: true,
clientsClaim: true,
cleanupOutdatedCaches: true,
runtimeCaching: [
{
urlPattern: /api\/urls\.unfurl$/,
@@ -109,6 +112,34 @@ export default () =>
},
},
},
{
urlPattern: /api\/attachments\.redirect/,
handler: "CacheFirst",
options: {
cacheName: "attachments-redirect-cache",
expiration: {
maxEntries: 100,
maxAgeSeconds: 120, // 120 seconds
},
cacheableResponse: {
statuses: [0, 200, 302], // Include redirects
},
},
},
{
urlPattern: /api\/files\.get/,
handler: "CacheFirst",
options: {
cacheName: "files-cache",
expiration: {
maxEntries: 50,
maxAgeSeconds: 604800, // 7 days
},
cacheableResponse: {
statuses: [0, 200, 206], // Include partial content for range requests
},
},
},
],
},
manifest: {