Request no caching for static files like webapp
This commit is contained in:
parent
f39f8f02bd
commit
025e6b1fba
1 changed files with 8 additions and 1 deletions
|
|
@ -22,7 +22,14 @@ def add_static_file(app: FastAPI, fname: str, folder: str) -> None:
|
|||
"""
|
||||
p = os.path.join(folder, fname)
|
||||
app.get(f"/{fname}", response_class=FileResponse, include_in_schema=False)(
|
||||
lambda: FileResponse(p)
|
||||
lambda: FileResponse(
|
||||
p,
|
||||
headers={
|
||||
"Cache-Control": "no-store, no-cache, must-revalidate, max-age=0",
|
||||
"Pragma": "no-cache",
|
||||
"Expires": "0",
|
||||
},
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue