Skip to content

Commit a6cc83c

Browse files
gitcommit90claude
andcommitted
site: never let browsers serve stale HTML
HTML shipped with stale-while-revalidate=3600, so after a deploy a visitor's browser could keep showing hour-old copies of pages they had already opened while fresh pages loaded the new design — two site versions in one session. All HTML responses are now no-cache (assets keep long-lived content-hash caching), and the site test asserts the header on every page. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 3c57f29 commit a6cc83c

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

site/server.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ const server = createServer(async (req, res) => {
314314
if (STATIC_PAGES[path]) {
315315
answer(res, 200, STATIC_PAGES[path], {
316316
"content-type": "text/html; charset=utf-8",
317-
"cache-control": "public, max-age=300, stale-while-revalidate=3600",
317+
"cache-control": "no-cache",
318318
});
319319
return;
320320
}
@@ -366,7 +366,7 @@ const server = createServer(async (req, res) => {
366366
if (page) {
367367
answer(res, 200, renderPage({ ...page, path, version: VERSION, assetVersion: SITE_ASSET_VERSION }), {
368368
"content-type": "text/html; charset=utf-8",
369-
"cache-control": "public, max-age=300, stale-while-revalidate=3600",
369+
"cache-control": "no-cache",
370370
});
371371
return;
372372
}

test/site.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ test("standalone 1helm.com website serves independent product and documentation
3535
for (const path of ["/manual", "/terms", "/privacy", "/manual/getting-started", "/manual/architecture", "/manual/outcome-ownership", "/manual/skills", "/manual/verification", "/manual/providers", "/manual/channel-computers", "/manual/connections", "/manual/install-macos", "/manual/install-linux", "/manual/install-windows", "/manual/self-hosting", "/manual/security-model"]) {
3636
const response = await fetch(base + path); assert.equal(response.status, 200, path);
3737
assert.match(response.headers.get("content-security-policy") || "", /default-src 'self'/);
38+
assert.equal(response.headers.get("cache-control"), "no-cache", `${path} must never be browser-cached`);
3839
}
3940
const gettingStarted = await (await fetch(`${base}/manual/getting-started`)).text();
4041
assert.match(gettingStarted, /On Windows 11 x64, download the signed Setup executable/i);

0 commit comments

Comments
 (0)