Add NetworkFirst caching strategy for navigation requests
This enables offline navigation by caching HTML documents generated by SSR. When offline, users can now navigate to cached pages using the service worker.
This commit is contained in:
@@ -79,6 +79,18 @@ export default defineNuxtConfig({
|
|||||||
{
|
{
|
||||||
urlPattern: /^https:\/\/authentik\.nucleoriofrio\.com\/.*/i,
|
urlPattern: /^https:\/\/authentik\.nucleoriofrio\.com\/.*/i,
|
||||||
handler: 'NetworkOnly'
|
handler: 'NetworkOnly'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
urlPattern: ({ request }) => request.mode === 'navigate',
|
||||||
|
handler: 'NetworkFirst',
|
||||||
|
options: {
|
||||||
|
cacheName: 'pages-cache',
|
||||||
|
networkTimeoutSeconds: 3,
|
||||||
|
expiration: {
|
||||||
|
maxEntries: 10,
|
||||||
|
maxAgeSeconds: 60 * 60 * 24 // 24 hours
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user