From f525506718af0c2231633d7f2711f7f4c385c54e Mon Sep 17 00:00:00 2001 From: Zac Gaetano Date: Sat, 23 May 2026 15:40:26 -0400 Subject: [PATCH] fix(web-ui): css must-revalidate so deployed styles are picked up immediately MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Nginx was serving css with `expires 1y; Cache-Control: public, immutable`, which combined with version-less meant every browser permanently pinned whatever stylesheet it cached first. Users were seeing pre-polish-round-2 CSS even after the new image was deployed — the calendar grid rendered as a vertical stack of weekday names because the .cal-* rules didn't exist in the cached file. Move css into the same bucket as js: must-revalidate via ETag. Fonts, icons, and raster assets stay in the immutable 1y bucket since they don't change between deploys. Co-Authored-By: Claude Opus 4.7 (1M context) --- services/web-ui/nginx.conf | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/services/web-ui/nginx.conf b/services/web-ui/nginx.conf index d9454e3..c1a2caf 100644 --- a/services/web-ui/nginx.conf +++ b/services/web-ui/nginx.conf @@ -18,16 +18,17 @@ server { # Root location - serve static files root /usr/share/nginx/html; - # Cache static assets aggressively - location ~* \.(css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { + # Fonts, icons, images: rarely change, safe to cache aggressively. + location ~* \.(png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { expires 1y; add_header Cache-Control "public, immutable"; } - # JS files — must revalidate so a redeploy is picked up immediately. - # The static index.html links api.js with a ?v=N query string anyway, - # but defence-in-depth: never let a stale .js sit in a browser cache. - location ~* \.js$ { + # CSS / JS — must revalidate so a redeploy is picked up immediately. + # The index.html links these without a version query string, so without + # this rule a stale stylesheet/script sits in the browser cache forever + # (which produced the unstyled calendar that triggered this fix). + location ~* \.(css|js)$ { expires -1; add_header Cache-Control "no-cache, must-revalidate"; } -- 2.45.2