Add NetworkFirst caching strategy for navigation requests
All checks were successful
build-and-deploy / build (push) Successful in 53s
build-and-deploy / deploy (push) Successful in 3s

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,
handler: 'NetworkOnly'
},
{
urlPattern: ({ request }) => request.mode === 'navigate',
handler: 'NetworkFirst',
options: {
cacheName: 'pages-cache',
networkTimeoutSeconds: 3,
expiration: {
maxEntries: 10,
maxAgeSeconds: 60 * 60 * 24 // 24 hours
}
}
}
]
},