Fix cache control error of index.html

• Retrun no-cache for all HTML responses not just .html files
• Prevent force browser refresh action after front-end rebuild
This commit is contained in:
yangdx 2025-10-17 12:43:04 +08:00
parent 35cd567c9e
commit f45dce347a

View file

@ -908,7 +908,9 @@ def create_app(args):
async def get_response(self, path: str, scope):
response = await super().get_response(path, scope)
if path.endswith(".html"):
is_html = path.endswith(".html") or response.media_type == "text/html"
if is_html:
response.headers["Cache-Control"] = (
"no-cache, no-store, must-revalidate"
)