mirror of
https://github.com/outline/outline.git
synced 2026-06-13 03:14:59 +03:00
chore/attachments-sw-cache (#9122)
This commit is contained in:
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user