mirror of
https://github.com/wahyd4/home-docker.git
synced 2026-08-09 04:15:52 +10:00
demo-service: add Cache-Control no-store to HTML content responses
Prevents browser from caching old responses that had wrong Content-Disposition header before the .draft/.bak fix.
This commit is contained in:
@@ -216,7 +216,9 @@ async def site_content(path: str = "", request: Request = None):
|
||||
return error_resp(404)
|
||||
# HTML files render inline; others (CSS, JS, images) served as files
|
||||
if target.suffix == ".html" or target.suffix in (".draft", ".bak"):
|
||||
return HTMLResponse(target.read_text())
|
||||
resp = HTMLResponse(target.read_text())
|
||||
resp.headers["Cache-Control"] = "no-store"
|
||||
return resp
|
||||
resp = FileResponse(target)
|
||||
resp.headers["Content-Disposition"] = "inline"
|
||||
return resp
|
||||
|
||||
Reference in New Issue
Block a user