From c304dcaadd19e6cdf8156be60d66747d4f1fec2c Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Fri, 17 Apr 2026 11:42:16 -0400 Subject: [PATCH] fix caching (2) --- web/nginx.conf | 8 +++----- web/src/main.tsx | 4 ++++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/web/nginx.conf b/web/nginx.conf index 019bc3f..0ceaf52 100644 --- a/web/nginx.conf +++ b/web/nginx.conf @@ -4,15 +4,13 @@ server { index index.html; # SPA fallback — serve index.html for all routes that don't match a file. + # no-cache ensures the browser revalidates on every visit so users never + # see stale HTML after OAuth redirects or deploys. location / { + add_header Cache-Control "no-cache" always; try_files $uri $uri/ /index.html; } - # index.html must always be revalidated so browsers pick up new bundles. - location = /index.html { - add_header Cache-Control "no-cache"; - } - # Hashed assets from Vite never change — cache them aggressively. location /assets/ { add_header Cache-Control "public, max-age=31536000, immutable"; diff --git a/web/src/main.tsx b/web/src/main.tsx index 8bd2a3a..4dcb245 100644 --- a/web/src/main.tsx +++ b/web/src/main.tsx @@ -5,6 +5,10 @@ import { router } from "./router/routes"; import { BreadcrumbProvider } from "./hooks/useBreadcrumb"; import "./index.css"; +window.addEventListener("pageshow", (event) => { + if (event.persisted) window.location.reload(); +}); + createRoot(document.getElementById("root")!).render( -- 2.51.2