fix: JS/CSS immer revalidieren (no-cache) + Version v24
Bisher bekamen /static/js und /static/css max-age=7200. Da index.html no-cache ist, konnte eine frische HTML mit 2h-altem, gecachtem JS/CSS gepaart werden — neue Features (z.B. Gruppen-Button) ohne passenden Handler. JS/CSS revalidieren jetzt bei jedem Load (304 wenn unveraendert); Icons & uebrige Assets behalten 2h. Deploys greifen so sofort beim Reload. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -179,7 +179,12 @@ async def add_cache_headers(request: Request, call_next):
|
||||
response.headers["Cache-Control"] = NO_CACHE
|
||||
response.headers["Pragma"] = "no-cache"
|
||||
response.headers["Expires"] = "0"
|
||||
# 2h cache for the rest of the frontend (JS/CSS/icons/etc.)
|
||||
# JS/CSS must revalidate on every load so a deploy takes effect on the next
|
||||
# reload (returns a cheap 304 when unchanged). Without this, a fresh
|
||||
# no-cache index.html could pair with stale 2h-cached scripts.
|
||||
elif path.startswith("/static/js/") or path.startswith("/static/css/"):
|
||||
response.headers["Cache-Control"] = NO_CACHE
|
||||
# 2h cache for the rest of the frontend (icons, fonts, images, …)
|
||||
elif path.startswith("/static/") or path.startswith("/icons/"):
|
||||
response.headers["Cache-Control"] = STATIC_CACHE
|
||||
# SPA fallback (everything else that isn't an API route) returns HTML;
|
||||
|
||||
Reference in New Issue
Block a user