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"; }