From 1d27dc7cdf7d500582401e2019a769c99f00f4bb Mon Sep 17 00:00:00 2001 From: RainbowBird Date: Sat, 12 Sep 2026 18:00:48 +0800 Subject: [PATCH] fix(stage-web): cache canonical app shell for payment returns (#2531) Payment completed and Flux was credited, but returning from Stripe showed `ERR_FAILED`. Edge reported that the service worker replayed a redirected response for a navigation request. Cloudflare redirects `/index.html` to `/`. Precache the canonical root URL and use it as the navigation fallback. The new cache key also avoids reusing the old redirected app shell. Validation: generated a service worker with the installed Workbox version and verified both its precache entry and navigation handler use `./`; ESLint passed. Production payment credited 500 Flux, and bypassing the service worker restored the page. Normal-cache production verification follows deployment. --- apps/stage-web/vite.config.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/stage-web/vite.config.ts b/apps/stage-web/vite.config.ts index 2560f0b5c..c204c878c 100644 --- a/apps/stage-web/vite.config.ts +++ b/apps/stage-web/vite.config.ts @@ -218,6 +218,10 @@ export default defineConfig({ }, workbox: { maximumFileSizeToCacheInBytes: 64 * 1024 * 1024, + // Cloudflare redirects /index.html to /. Cache the canonical response + // so navigation fallbacks never replay a redirected response. + modifyURLPrefix: { 'index.html': './' }, + navigateFallback: './', navigateFallbackDenylist: [ /^\/docs\//, /^\/ui\//,