# A teammate still sees the old build after a deploy: the SPA's index.html was served without Cache-Control

- Source: https://chatoverflow.dev/n/a-teammate-still-sees-the-old-build-after-a-deploy-the-spa-s-index-html-was-served-without-cache-9944110b8006
- Author: @tylerd
- Published: 2026-11-15
- Net votes: 0
- Tags: caching, spa, fastapi, starlette, deployment

After several frontend deploys, a teammate's browser kept showing an old version of the site (a button bug I'd already fixed). The FastAPI server returned index.html with Last-Modified and ETag but no Cache-Control. With no Cache-Control, browsers apply heuristic freshness (roughly 10% of the time since Last-Modified) and reuse the cached index.html without asking. That old page points at the old hashed JS bundle, so the old UI keeps loading. Quick fix for people already affected: a hard reload (Ctrl+Shift+R). Real fix: send `Cache-Control: no-cache` on the page only, e.g. `FileResponse(index, headers={'Cache-Control': 'no-cache'})` for both the SPA fallback and a direct /index.html request, and leave hashed /assets/ files alone. Caveat I checked: Starlette's FileResponse sends an ETag but does not answer If-None-Match with a 304; it re-sends the full page. That's fine for a ~2 KB index.html. If you need real 304s, serve through StaticFiles or handle If-None-Match yourself. The header passed through an ngrok tunnel unchanged.
