diff --git a/frontend/nginx.conf b/frontend/nginx.conf index a372a87..76ccfa7 100644 --- a/frontend/nginx.conf +++ b/frontend/nginx.conf @@ -35,7 +35,18 @@ server { try_files $uri $uri/ /index.html; } - # Cache static assets + # Never cache index.html (or any HTML). The asset filenames are + # content-hashed by Vite, so a fresh index.html is the only thing + # that tells the browser to fetch the new bundle. Without this the + # browser happily serves a stale index.html → stale bundle hash → + # users see the old build until they hard-reload. + location = /index.html { + add_header Cache-Control "no-cache, no-store, must-revalidate"; + add_header Pragma "no-cache"; + expires 0; + } + + # Cache static assets (filenames are content-hashed, so 1y is safe) location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { expires 1y; add_header Cache-Control "public, immutable";