This commit is contained in:
+4
-1
@@ -783,6 +783,9 @@ if static_dir.exists():
|
||||
async def spa(path: str):
|
||||
root = static_dir.resolve()
|
||||
target = (root / path).resolve()
|
||||
headers = {"Cache-Control": "no-cache, no-store, must-revalidate, max-age=0"}
|
||||
if target.is_file() and target.is_relative_to(root):
|
||||
if target.name == "sw.js":
|
||||
return FileResponse(target, headers=headers)
|
||||
return FileResponse(target)
|
||||
return FileResponse(root / "index.html")
|
||||
return FileResponse(root / "index.html", headers=headers)
|
||||
|
||||
Reference in New Issue
Block a user