Static assets get no configurable headers on native Cloudflare deploys of framework apps
維護者通常 1 天內回覆
已經有一個關聯 PR 被合併了。
- #670 來自 @dvkam —— 已合併
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 50/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 活躍
- 技術堆疊
- typescript, vite
- 領域
- cloud
研究方向
Start by tracing uploadAssets, readGeneratedAssetHeaders, and planAssetWorkerBypass for native Cloudflare deploys, then compare their behavior with the TanStack Start asset configuration described here. Check or add coverage for user-authored _headers and fingerprinted assets; done means the reported cache headers are applied to static assets, or the docs accurately describe the limitation.
由索引模型根據 Issue 內容生成。
描述
Summary
A TanStack Start app deployed with void deploy --platform cloudflare serves its static assets without any configurable headers:
- A
public/_headersfile is copied todist/client/_headers, but it never applies in production.uploadAssetsignores/_headers, andreadGeneratedAssetHeadersonly sends a file whose first line is Void's generated marker ("A user-authored_headersis not sent on this path"). - Void's own immutable caching for fingerprinted bundles never runs either.
planAssetWorkerBypassonly applies when the builtwrangler.jsonhasassets.run_worker_first: ["/**"], and the TanStack Start build has only"assets": { "directory": "../client" }. With the_headersfile removed, the build generates no_headersat all. - As a result, hashed files under
/assets/are served with Cloudflare's defaultCache-Control: public, max-age=0, must-revalidate. Browsers revalidate every JS and CSS chunk on every page view.
This contradicts two docs pages:
guide/edge/static-assets.md("Native Cloudflare deployments"): "Withvoid deploy --platform cloudflare, generated JavaScript bundles with content fingerprints receive immutable caching."guide/edge/headers.md("Framework_headersfiles"): "Void reads_headersfiles produced by supported frameworks."
Reproduction
[email protected],@tanstack/[email protected], Vite 8, deployed withvoid deploy --platform cloudflarevoid.config.tssetscloudflare.cache.enabled, a custom domain route, a D1 binding and noroutingoptionspublic/_headers:/assets/* Cache-Control: public, max-age=31536000, immutable- After deploy,
curl -sI https://<site>/assets/<hashed>.jsshowscache-control: public, max-age=0, must-revalidate. CSS is the same.
I also tried routing.headers in void.config.ts ('/assets/*': ['Cache-Control: public, max-age=31536000, immutable']). In the local preview (vite preview in workerd), assets still came back with max-age=0, must-revalidate. I didn't deploy that variant, since the assets are served without starting the Worker, so I don't expect the rules to reach them.
Expected
One of these, for framework apps on native Cloudflare deploys:
- send a user-authored
_headerswith the asset upload (as Wrangler does), - generate the immutable
_headersfor fingerprinted files even withoutrun_worker_first, or - apply
routing.headersto static assets.
Failing those, the docs should say framework apps on --platform cloudflare get no asset headers.
Workaround
A Response Header Transform Rule on the zone that sets Cache-Control: public, max-age=31536000, immutable for a 200 under /assets/.
- 主要語言
- TypeScript
- 星號
- 627
- 分支
- 66
- 平均合併
- 14 小時 17 分鐘
- 30 天內合併 PR
- 200
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
voidzero-dev/void 的其他 Issue
-
難度 4/5 3-5 天 新手友好度 55/100
voidzero-dev/void#718 · 1 個 reaction ·
維護者通常 1 天內回覆
-
難度 4/5 3-5 天 新手友好度 48/100
voidzero-dev/void#717 ·
維護者通常 1 天內回覆
-
難度 5/5 一週以上 新手友好度 28/100
voidzero-dev/void#692 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 5/5 一週以上 新手友好度 30/100
voidzero-dev/void#689 ·
維護者通常 1 天內回覆
-
`withValidator({ body })` rejects the multipart bodies that `useForm` and `action()` send for files未關閉
難度 4/5 3-5 天 新手友好度 35/100
voidzero-dev/void#679 ·
維護者通常 1 天內回覆
查看 voidzero-dev/void 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 78/100
vercel-labs/durable-harness#53 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 82/100
維護者通常 1 天內回覆
-
area/docs area/ui enhancement
難度 1/5 1-3 小時 新手友好度 88/100
melgarafael/DeskcommCRM#4098 ·
維護者通常 1 天內回覆
-
bug ready-for-agent
難度 2/5 1-3 小時 新手友好度 86/100
kerti/balances-v2#801 ·
維護者通常 1 天內回覆
-
lesson-submission pending-review
難度 1/5 1 小時以內 新手友好度 84/100
Ikalus1988/MisakaNet#4510 ·
維護者通常 1 天內回覆