From e59f7b653d95c7cdead39ec7aa37d91de95a680e Mon Sep 17 00:00:00 2001 From: josedario87 Date: Mon, 13 Oct 2025 02:27:32 -0600 Subject: [PATCH] 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. --- nuxt4/nuxt.config.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/nuxt4/nuxt.config.ts b/nuxt4/nuxt.config.ts index ef5782e..7505cb3 100644 --- a/nuxt4/nuxt.config.ts +++ b/nuxt4/nuxt.config.ts @@ -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 + } + } } ] },