Skip to content

Commit f6bd2d6

Browse files
authored
fix(server): stop sending immutable cache-control on /__webjs/core/* (#38)
The /__webjs/core/* paths are un-versioned: every bump of @webjskit/core ships different bytes at the same URL. Sending `cache-control: public, max-age=31536000, immutable` instructed edge CDNs (Cloudflare in our case) to pin the prior bytes for up to a year, which silently broke the next deploy: browsers loaded the old client renderer against a server emitting the new SSR shape, and any new exports (e.g. slot.js entry points added for core 0.6.0) resolved to undefined in the cached file. ETag + ~1h max-age is the right policy until URLs carry a version hash. Drop immutable. Bumps @webjskit/server to 0.7.1. Regression: 2026-05-20, ui.webjs.dev tier-2 components after @webjskit/core 0.5.0 -> 0.6.0 republish.
1 parent 06211ff commit f6bd2d6

3 files changed

Lines changed: 15 additions & 3 deletions

File tree

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@webjskit/server",
3-
"version": "0.7.0",
3+
"version": "0.7.1",
44
"type": "module",
55
"description": "webjs dev/prod server: SSR, router, API, server actions, live reload",
66
"main": "index.js",

packages/server/src/dev.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,11 +389,23 @@ async function handleCore(req, ctx) {
389389
}
390390

391391
// Core module: /__webjs/core/*
392+
//
393+
// ETag + ~1h max-age, NOT immutable. The URL path is un-versioned
394+
// (`/__webjs/core/src/render-client.js` etc.), so bumping
395+
// `@webjskit/core` ships different bytes at the same URL. An
396+
// `immutable` cache-control directive at an edge CDN (Cloudflare,
397+
// Vercel, Fly) keeps the prior bytes pinned for up to a year, which
398+
// silently bricks the next deploy: browsers load the old client
399+
// renderer against a server emitting the new SSR shape, and any
400+
// exports added in the bump (e.g., the slot.js entry points landed
401+
// for 0.6.0) resolve to undefined in the cached file.
402+
// Regression: 2026-05-20, ui.webjs.dev tier-2 components after
403+
// @webjskit/core 0.5.0 -> 0.6.0 republish.
392404
if (path.startsWith('/__webjs/core/')) {
393405
const rel = path.slice('/__webjs/core/'.length);
394406
const abs = resolve(coreDir, rel);
395407
if (!abs.startsWith(coreDir)) return new Response('forbidden', { status: 403 });
396-
return fileResponse(abs, { dev, immutable: !dev });
408+
return fileResponse(abs, { dev, immutable: false });
397409
}
398410

399411
// Vendor bundles: /__webjs/vendor/<pkg>.js: generic auto-bundler

0 commit comments

Comments
 (0)