From a9f0586b8802a44f8710346d76bcbdcc0865385c Mon Sep 17 00:00:00 2001 From: Moepchi Date: Sun, 27 Sep 2026 20:12:02 +0000 Subject: [PATCH] web: keep the PWA's SPA fallback away from the gateway's /api/ pages With UI and gateway on one origin, the service worker answered a navigation to /api/store/admin with index.html, so the moderation page opened the client instead. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU --- web/vite.config.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/web/vite.config.ts b/web/vite.config.ts index 23fd20a..e940c42 100644 --- a/web/vite.config.ts +++ b/web/vite.config.ts @@ -95,6 +95,11 @@ export default defineConfig({ // ignores non-GET and non-http(s) requests (ws:// isn't touched), so // no extra runtimeCaching exclusions are needed here. globPatterns: ['**/*.{js,css,html,ico,png,svg,woff2}'], + // The SPA fallback answers every navigation with index.html — except + // the gateway's own pages under /api/ (e.g. /api/store/admin), which + // would otherwise open the client instead when UI and gateway share + // an origin. + navigateFallbackDenylist: [/^\/api\//], }, }), ],