mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-10-24 23:44:20 +00:00
dont cache new locale entry points (#10101)
This commit is contained in:
@@ -26,11 +26,12 @@ async def cache_control(
|
||||
"""Cache control middleware that sets appropriate cache headers based on file type and response status"""
|
||||
response: web.Response = await handler(request)
|
||||
|
||||
if (
|
||||
request.path.endswith(".js")
|
||||
or request.path.endswith(".css")
|
||||
or request.path.endswith("index.json")
|
||||
):
|
||||
path_filename = request.path.rsplit("/", 1)[-1]
|
||||
is_entry_point = path_filename.startswith("index") and path_filename.endswith(
|
||||
".json"
|
||||
)
|
||||
|
||||
if request.path.endswith(".js") or request.path.endswith(".css") or is_entry_point:
|
||||
response.headers.setdefault("Cache-Control", "no-cache")
|
||||
return response
|
||||
|
||||
|
||||
@@ -48,6 +48,13 @@ CACHE_SCENARIOS = [
|
||||
"expected_cache": "no-cache",
|
||||
"should_have_header": True,
|
||||
},
|
||||
{
|
||||
"name": "localized_index_json_no_cache",
|
||||
"path": "/templates/index.zh.json",
|
||||
"status": 200,
|
||||
"expected_cache": "no-cache",
|
||||
"should_have_header": True,
|
||||
},
|
||||
# Non-matching files
|
||||
{
|
||||
"name": "html_no_header",
|
||||
|
||||
Reference in New Issue
Block a user