Merge pull request #86 from unslothai/fix/index-html-cache-headers

Fix: Browser serving stale frontend after rebuild
This commit is contained in:
Roland Tannous 2026-02-15 10:17:38 +04:00 committed by GitHub
commit 7411be50a0

View file

@ -128,7 +128,7 @@ def setup_frontend(app: FastAPI, build_path: Path):
@app.get("/")
async def serve_root():
return FileResponse(build_path / "index.html")
return FileResponse(build_path / "index.html", headers={"Cache-Control": "no-cache, no-store, must-revalidate"})
@app.get("/{full_path:path}")
async def serve_frontend(full_path: str):
@ -139,7 +139,7 @@ def setup_frontend(app: FastAPI, build_path: Path):
if file_path.is_file():
return FileResponse(file_path)
return FileResponse(build_path / "index.html")
return FileResponse(build_path / "index.html", headers={"Cache-Control": "no-cache, no-store, must-revalidate"})
return True
return False