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:
2025-10-13 02:27:32 -06:00
parent 0a7c8d9cd0
commit e59f7b653d

View File

@@ -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
}
}
} }
] ]
}, },