diff --git a/frontend/nginx.conf b/frontend/nginx.conf index 0783a06..6e5d8e1 100644 --- a/frontend/nginx.conf +++ b/frontend/nginx.conf @@ -26,7 +26,24 @@ server { proxy_set_header X-Forwarded-Proto $scheme; } + # index.html, app.js and the stylesheets keep the same filenames across + # releases, so without this a browser happily pairs a freshly fetched + # index.html with a cached app.js from a previous deploy. That mismatch + # throws on the first missing element id and kills the whole script — which + # looks exactly like a server-side failure. "no-cache" still allows caching, + # it only forces a revalidation, so unchanged files cost one 304. + location ~* \.(?:html|js|css)$ { + add_header Cache-Control "no-cache"; + try_files $uri $uri/ /index.html; + } + + # Fonts are content-stable and large; let them sit in the browser cache. + location ~* \.(?:woff2|woff|ttf)$ { + add_header Cache-Control "public, max-age=2592000"; + } + location / { + add_header Cache-Control "no-cache"; try_files $uri $uri/ /index.html; } }