From 385443522b3affd274ecaad6a113ee24c45ae99c Mon Sep 17 00:00:00 2001 From: owain Date: Thu, 18 Jun 2026 12:00:58 +0100 Subject: [PATCH] frontend nginx: no-cache on index.html so deploys aren't masked by stale SPA shell (Edge heuristic caching) --- frontend/nginx-spa.conf | 8 ++++++++ milevault_export/frontend/nginx-spa.conf | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/frontend/nginx-spa.conf b/frontend/nginx-spa.conf index 55f7e0a..c1af1a6 100644 --- a/frontend/nginx-spa.conf +++ b/frontend/nginx-spa.conf @@ -7,6 +7,14 @@ server { try_files $uri $uri/ /index.html; } + # Never let the browser serve a stale SPA shell: it references hashed asset + # filenames, so a cached index.html strands users on an old build after a + # deploy (Edge heuristically caches it when no Cache-Control is set). Force + # revalidation — a cheap 304 when unchanged — so new deploys are picked up. + location = /index.html { + add_header Cache-Control "no-cache"; + } + location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2)$ { expires 1y; add_header Cache-Control "public, immutable"; diff --git a/milevault_export/frontend/nginx-spa.conf b/milevault_export/frontend/nginx-spa.conf index 55f7e0a..c1af1a6 100644 --- a/milevault_export/frontend/nginx-spa.conf +++ b/milevault_export/frontend/nginx-spa.conf @@ -7,6 +7,14 @@ server { try_files $uri $uri/ /index.html; } + # Never let the browser serve a stale SPA shell: it references hashed asset + # filenames, so a cached index.html strands users on an old build after a + # deploy (Edge heuristically caches it when no Cache-Control is set). Force + # revalidation — a cheap 304 when unchanged — so new deploys are picked up. + location = /index.html { + add_header Cache-Control "no-cache"; + } + location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2)$ { expires 1y; add_header Cache-Control "public, immutable";