From 76239ee83b65530af595c36682f84a57eba10a9c Mon Sep 17 00:00:00 2001 From: nmemmert Date: Mon, 10 Aug 2026 08:49:15 -0400 Subject: [PATCH] Fix redirects broken by service worker navigate fallback; v1.1.31 The SW's navigateFallback was using a denylist, so any path not explicitly excluded (e.g. /spotify, /apple, /amazon, custom admin redirects) got served the cached index.html instead of reaching the server's redirect handler. Switch to navigateFallbackAllowlist: the SW only intercepts known SPA routes; all other paths hit the network so server-side 301/302 redirects work correctly. Co-Authored-By: Claude Sonnet 4.6 --- package.json | 2 +- vite.config.ts | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 30b4ac0..f82d549 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "siteforge", "private": true, - "version": "1.1.30", + "version": "1.1.31", "type": "module", "scripts": { "dev": "vite", diff --git a/vite.config.ts b/vite.config.ts index a54f83c..d07d5fe 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -23,7 +23,15 @@ export default defineConfig({ }, workbox: { navigateFallback: '/index.html', - navigateFallbackDenylist: [/^\/api\//, /^\/feed\.xml/, /^\/uploads\//], + // Allowlist-only approach: SW only serves index.html for known SPA routes. + // Everything else (admin-configured redirects, /spotify, /apple, /amazon, + // feed.xml, robots.txt, etc.) goes to the server so server-side redirects work. + navigateFallbackAllowlist: [ + /^\/$/, // exact root + /^\/(start-here|about|contact|resources|thanks|preview|privacy|terms|salvation)(\/.*)?$/, + /^\/(study|studys|episodes|finished|downloads|subscribe|certificate)(\/.*)?$/, + /^\/(questions|admin|email|contacts|calendar)(\/.*)?$/, + ], runtimeCaching: [ { urlPattern: /^\/api\/(episodes|questions)/,