Conversation
Rolldown switched official bundle content hashes from 8 to 12 chars, so the hardcoded {8} immutable-asset pattern no longer matched and every hashed chunk fell through to no-store. Widen the pattern to 8+ chars with dash or dot separators, and strip auth cookie refresh from public long-cache responses so browsers can reuse them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
官方 renderer 的所有静态资源响应都带
cache-control: no-store,导致每次刷新整包 JS/CSS/字体/图片全部重新下载,移动端弱网下首屏极慢。按设计只有入口 HTML 和动态注入脚本该 no-store,content-hash 资源应immutable长缓存。根因
gateway/runtime/http/static-assets.cjs里判定 content-hash 资源的正则是-[A-Za-z0-9_-]{8}\.(?:avif|css|gif|ico|jpe?g|js|png|svg|webp|woff2?)$,即 hash 必须是恰好 8 位且以连字符分隔。而官方 bundle 已由 Vite 切到 rolldown,hash 变成 12 位,且部分 wasm 用点分隔(如DocumentFormat.OpenXml.4g1x2psnat.wasm)。结果 8000+ 个 chunk 无一命中 immutable 分支,全部落到兜底no-store。改动
CONTENT_HASHED_ASSET_FILE_RE = /[-.][A-Za-z0-9_-]{8,}\.(?!html$)[A-Za-z0-9]{1,8}$/i:兼容 8~13 位 hash、-/.两种分隔符,覆盖 js/css/wasm/字体/图片等,且显式排除 html(入口永远不固化)。immutable;固定名(无 hash)资源维持no-store。验证(241.t 真机)
部署后对入口 HTML 引用的全部静态资源做 curl 巡检:
official-patched-v8/assets/index-*.js/assets/*.css→public, max-age=31536000, immutable✅assets/*.woff2/*.webp等 →public, max-age=31536000, immutable✅/、/codex-web-config.js、/api/*等动态入口 → 维持no-store/private, no-cache, must-revalidate✅附注
run-gateway.cjs不再内置--headless --disable-gpu,在无 GPU 的无头服务器上 Chromium GPU 进程 FATAL 会拖垮 gateway。这属于部署环境适配,已在 241.t 本地 runner 处理,未纳入本 PR(避免扩大改动面)。/official/裸路径访问返回 500(EISDIR),是 2.0.3/2.1.0 都存在的独立既有问题,与本改动无关。