diff --git a/main.py b/main.py index 78ccdeff..4ba37a37 100644 --- a/main.py +++ b/main.py @@ -3325,7 +3325,9 @@ class NoCacheStaticFiles(StaticFiles): response = await super().get_response(path, scope) # Force revalidation for HTML/JS/CSS/JSON so code changes show up # immediately after git pull. Other assets (images, fonts) can cache. - if any(path.endswith(ext) for ext in (".html", ".js", ".css", ".json")): + # Empty path ("") or paths ending in / resolve to index.html via html=True. + is_html_route = path == "" or path.endswith("/") or path.endswith(".html") + if is_html_route or any(path.endswith(ext) for ext in (".js", ".css", ".json")): response.headers["Cache-Control"] = "no-cache, must-revalidate" return response