mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2025-12-09 05:54:24 +08:00
dont cache new locale entry points
This commit is contained in:
parent
b60dc31627
commit
67a8d2e317
@ -26,11 +26,12 @@ async def cache_control(
|
|||||||
"""Cache control middleware that sets appropriate cache headers based on file type and response status"""
|
"""Cache control middleware that sets appropriate cache headers based on file type and response status"""
|
||||||
response: web.Response = await handler(request)
|
response: web.Response = await handler(request)
|
||||||
|
|
||||||
if (
|
path_filename = request.path.rsplit("/", 1)[-1]
|
||||||
request.path.endswith(".js")
|
is_entry_point = path_filename.startswith("index") and path_filename.endswith(
|
||||||
or request.path.endswith(".css")
|
".json"
|
||||||
or request.path.endswith("index.json")
|
)
|
||||||
):
|
|
||||||
|
if request.path.endswith(".js") or request.path.endswith(".css") or is_entry_point:
|
||||||
response.headers.setdefault("Cache-Control", "no-cache")
|
response.headers.setdefault("Cache-Control", "no-cache")
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|||||||
@ -48,6 +48,13 @@ CACHE_SCENARIOS = [
|
|||||||
"expected_cache": "no-cache",
|
"expected_cache": "no-cache",
|
||||||
"should_have_header": True,
|
"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
|
# Non-matching files
|
||||||
{
|
{
|
||||||
"name": "html_no_header",
|
"name": "html_no_header",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user