Правка кеширования данных сайта
This commit is contained in:
+5
-1
@@ -208,9 +208,13 @@ def _mount_spa(app: FastAPI) -> None:
|
||||
full_path
|
||||
and _STATIC_DIR in candidate.parents
|
||||
and candidate.is_file()
|
||||
and candidate.name != "index.html"
|
||||
):
|
||||
# Хэшированные ассеты Vite — обычное кэширование (имя меняется при сборке).
|
||||
return FileResponse(candidate)
|
||||
return FileResponse(index_file)
|
||||
# index.html (корень и SPA-маршруты) — НЕ кэшируем: иначе браузер отдаёт старый
|
||||
# документ из кэша и при недоступности хоста не доходит до Caddy с заглушкой.
|
||||
return FileResponse(index_file, headers={"Cache-Control": "no-store"})
|
||||
|
||||
|
||||
app = create_app()
|
||||
|
||||
Reference in New Issue
Block a user