From f45dce347a25769bf198a5b92316b0697b9baaf5 Mon Sep 17 00:00:00 2001 From: yangdx Date: Fri, 17 Oct 2025 12:43:04 +0800 Subject: [PATCH] Fix cache control error of index.html MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Retrun no-cache for all HTML responses not just .html files • Prevent force browser refresh action after front-end rebuild --- lightrag/api/lightrag_server.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lightrag/api/lightrag_server.py b/lightrag/api/lightrag_server.py index e8fdb700..a558dae3 100644 --- a/lightrag/api/lightrag_server.py +++ b/lightrag/api/lightrag_server.py @@ -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" )