This commit is contained in:
Christian Byrne 2026-03-14 21:29:30 +00:00 committed by GitHub
commit 90a6992b3c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 10 deletions

View File

@ -32,7 +32,7 @@ async def cache_control(
) )
if request.path.endswith(".js") or request.path.endswith(".css") or is_entry_point: 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-store")
return response return response
# Early return for non-image files - no cache headers needed # Early return for non-image files - no cache headers needed

View File

@ -310,7 +310,7 @@ class PromptServer():
@routes.get("/") @routes.get("/")
async def get_root(request): async def get_root(request):
response = web.FileResponse(os.path.join(self.web_root, "index.html")) response = web.FileResponse(os.path.join(self.web_root, "index.html"))
response.headers['Cache-Control'] = 'no-cache' response.headers['Cache-Control'] = 'no-store, must-revalidate'
response.headers["Pragma"] = "no-cache" response.headers["Pragma"] = "no-cache"
response.headers["Expires"] = "0" response.headers["Expires"] = "0"
return response return response

View File

@ -28,31 +28,31 @@ CACHE_SCENARIOS = [
}, },
# JavaScript/CSS scenarios # JavaScript/CSS scenarios
{ {
"name": "js_no_cache", "name": "js_no_store",
"path": "/script.js", "path": "/script.js",
"status": 200, "status": 200,
"expected_cache": "no-cache", "expected_cache": "no-store",
"should_have_header": True, "should_have_header": True,
}, },
{ {
"name": "css_no_cache", "name": "css_no_store",
"path": "/styles.css", "path": "/styles.css",
"status": 200, "status": 200,
"expected_cache": "no-cache", "expected_cache": "no-store",
"should_have_header": True, "should_have_header": True,
}, },
{ {
"name": "index_json_no_cache", "name": "index_json_no_store",
"path": "/api/index.json", "path": "/api/index.json",
"status": 200, "status": 200,
"expected_cache": "no-cache", "expected_cache": "no-store",
"should_have_header": True, "should_have_header": True,
}, },
{ {
"name": "localized_index_json_no_cache", "name": "localized_index_json_no_store",
"path": "/templates/index.zh.json", "path": "/templates/index.zh.json",
"status": 200, "status": 200,
"expected_cache": "no-cache", "expected_cache": "no-store",
"should_have_header": True, "should_have_header": True,
}, },
# Non-matching files # Non-matching files