diff --git a/lyra/web/server.py b/lyra/web/server.py index 10c24d0..c991764 100644 --- a/lyra/web/server.py +++ b/lyra/web/server.py @@ -50,6 +50,16 @@ def _last_user_message(messages: list[dict]) -> str: def create_app() -> FastAPI: app = FastAPI(title="Lyra Web") + @app.middleware("http") + async def _no_stale_shell(request: Request, call_next): + """Always revalidate HTML/JS so a PWA can't serve a stale app shell after a + deploy (iOS applies heuristic caching when no cache header is set).""" + resp = await call_next(request) + ct = resp.headers.get("content-type", "") + if "text/html" in ct or "javascript" in ct: + resp.headers["Cache-Control"] = "no-cache, must-revalidate" + return resp + @app.get("/_health") async def health() -> dict: return {"ok": True} diff --git a/lyra/web/static/session.html b/lyra/web/static/session.html index f342823..5d40fec 100644 --- a/lyra/web/static/session.html +++ b/lyra/web/static/session.html @@ -380,7 +380,7 @@ ${v.last_note ? `
“${esc(v.last_note)}”
` : ''} `).join('')}` - : '

No roster yet — tell Lyra who\\'s at the table.

'} + : '

No roster yet — tell Lyra who is at the table.

'}