fix: add Cache-Control no-cache for index.html to prevent stale JS bundles
This commit is contained in:
@@ -7,3 +7,5 @@
|
||||
{"t":0,"agent":"a61ca95","agent_type":"unknown","event":"agent_stop","success":true}
|
||||
{"t":0,"agent":"a3d8225","agent_type":"unknown","event":"agent_stop","success":true}
|
||||
{"t":0,"agent":"a2e68c7","agent_type":"unknown","event":"agent_stop","success":true}
|
||||
{"t":0,"agent":"ab31339","agent_type":"unknown","event":"agent_stop","success":true}
|
||||
{"t":0,"agent":"a8a4425","agent_type":"unknown","event":"agent_stop","success":true}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"session_id":"4bae7914-9326-440b-89bc-283136679e6c","transcript_path":"C:\\Users\\uldvs\\.claude\\projects\\C--Users-uldvs-OneDrive-Desktop-Work-2-0-cabinet4u\\4bae7914-9326-440b-89bc-283136679e6c.jsonl","cwd":"C:\\Users\\uldvs\\OneDrive\\Desktop\\Work 2.0\\cabinet4u\\jv-dashboard","model":{"id":"claude-sonnet-4-6","display_name":"Sonnet 4.6"},"workspace":{"current_dir":"C:\\Users\\uldvs\\OneDrive\\Desktop\\Work 2.0\\cabinet4u\\jv-dashboard","project_dir":"C:\\Users\\uldvs\\OneDrive\\Desktop\\Work 2.0\\cabinet4u","added_dirs":["C:/Users/uldvs/OneDrive/Desktop/Work 2.0/cabinet4u","C:\\Users\\uldvs\\.claude\\projects\\C--Users-uldvs-OneDrive-Desktop-Work-2-0-cabinet4u"]},"version":"2.1.112","output_style":{"name":"default"},"cost":{"total_cost_usd":18.23734365,"total_duration_ms":51244609,"total_api_duration_ms":3920926,"total_lines_added":4786,"total_lines_removed":725},"context_window":{"total_input_tokens":6334,"total_output_tokens":226563,"context_window_size":200000,"current_usage":{"input_tokens":3,"output_tokens":209,"cache_creation_input_tokens":793,"cache_read_input_tokens":109364},"used_percentage":55,"remaining_percentage":45},"exceeds_200k_tokens":false,"rate_limits":{"five_hour":{"used_percentage":22,"resets_at":1777398000},"seven_day":{"used_percentage":1,"resets_at":1777993200}}}
|
||||
{"session_id":"4bae7914-9326-440b-89bc-283136679e6c","transcript_path":"C:\\Users\\uldvs\\.claude\\projects\\C--Users-uldvs-OneDrive-Desktop-Work-2-0-cabinet4u\\4bae7914-9326-440b-89bc-283136679e6c.jsonl","cwd":"C:\\Users\\uldvs\\OneDrive\\Desktop\\Work 2.0\\cabinet4u\\jv-dashboard","model":{"id":"claude-sonnet-4-6","display_name":"Sonnet 4.6"},"workspace":{"current_dir":"C:\\Users\\uldvs\\OneDrive\\Desktop\\Work 2.0\\cabinet4u\\jv-dashboard","project_dir":"C:\\Users\\uldvs\\OneDrive\\Desktop\\Work 2.0\\cabinet4u","added_dirs":["C:/Users/uldvs/OneDrive/Desktop/Work 2.0/cabinet4u","C:\\Users\\uldvs\\.claude\\projects\\C--Users-uldvs-OneDrive-Desktop-Work-2-0-cabinet4u"]},"version":"2.1.112","output_style":{"name":"default"},"cost":{"total_cost_usd":21.369161550000005,"total_duration_ms":52905400,"total_api_duration_ms":4430743,"total_lines_added":4791,"total_lines_removed":727},"context_window":{"total_input_tokens":6553,"total_output_tokens":251773,"context_window_size":200000,"current_usage":{"input_tokens":3,"output_tokens":220,"cache_creation_input_tokens":4529,"cache_read_input_tokens":145164},"used_percentage":75,"remaining_percentage":25},"exceeds_200k_tokens":false,"rate_limits":{"five_hour":{"used_percentage":30,"resets_at":1777398000},"seven_day":{"used_percentage":2,"resets_at":1777993200}}}
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"lastSentAt": "2026-04-28T16:44:28.964Z"
|
||||
"lastSentAt": "2026-04-28T17:09:36.025Z"
|
||||
}
|
||||
@@ -3,5 +3,5 @@
|
||||
"total_spawned": 0,
|
||||
"total_completed": 0,
|
||||
"total_failed": 0,
|
||||
"last_updated": "2026-04-28T16:47:34.267Z"
|
||||
"last_updated": "2026-04-28T17:12:39.887Z"
|
||||
}
|
||||
+5
-2
@@ -45,10 +45,13 @@ async function serveStatic(pathname: string): Promise<Response | null> {
|
||||
const clean = decodeURIComponent(pathname.split('?')[0])
|
||||
const filePath = join(DIST_ROOT, clean === '/' ? 'index.html' : clean)
|
||||
const f = Bun.file(filePath)
|
||||
if (await f.exists()) return new Response(f)
|
||||
if (await f.exists()) {
|
||||
const isHtml = filePath.endsWith('.html')
|
||||
return new Response(f, { headers: isHtml ? { 'Cache-Control': 'no-cache, no-store, must-revalidate' } : {} })
|
||||
}
|
||||
// SPA fallback — serve index.html for all non-file routes
|
||||
const index = Bun.file(join(DIST_ROOT, 'index.html'))
|
||||
if (await index.exists()) return new Response(index, { headers: { 'Content-Type': 'text/html' } })
|
||||
if (await index.exists()) return new Response(index, { headers: { 'Content-Type': 'text/html', 'Cache-Control': 'no-cache, no-store, must-revalidate' } })
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user