feat(cloudflare): prewarm canonical RSC navigation requests - #2784
feat(cloudflare): prewarm canonical RSC navigation requests#2784james-elicx wants to merge 45 commits into
Conversation
commit: |
|
Performance benchmarksCompared 0 improved · 5 regressed · 1 within ±1.5%
View detailed results and traces 🟢 improvement · 🔴 regression · ⚫ change below 1.5% · paired base/head |
…warm # Conflicts: # tests/cloudflare-cdn-cache.test.ts
…warm # Conflicts: # packages/vinext/src/server/app-rsc-handler.ts
|
/bigbonk review for issues |
|
/deploy-preview |
|
|
Posted my review to PR #2784: #2784 (comment) SummaryI reviewed the security- and correctness-sensitive core of this large (13k line, 100 file) PR, focusing on the canonical RSC request/ Verdict: no blocking issues. This is a strong, defense-in-depth implementation that consistently fails closed and is extensively tested. Non-blocking findings I posted:
I explicitly verified as safe: the streaming meta injection (multibyte handling, bounded buffering, header invalidation), no XSS in the manifest URL injection, the behavior-preserving |
…warm # Conflicts: # packages/vinext/src/server/app-rsc-handler.ts
Summary
Varyverbatim, plus adapter-ownedVaryfields that deploy warmers can reproduce; Cloudflare declaresX-Forwarded-Protowithout putting Cloudflare-specific policy in core vinext?_rsc,RSC: 1,Accept: text/x-component, and no source/router-state reuse headersrouter.prefetch(), soft navigation, and deploy prewarming share that identity, including after an intercepted navigation; a completed prefetch is reused instead of issuing a second RSC request_rsc,Next-Url, router state, mounted slots, and interception context remain available where response selection needs themVarymetadata; fail closed for private/no-store responses, cookies, redirects, unsafeVary, middleware/config effects, or incomplete source-independence proofHost, and Cloudflare's overwrittenX-Forwarded-Proto; HTML does not vary onAccept__vinext_html/__vinext_rscfamily tags across allVaryvariants, hosts, and schemes so tag/path invalidation purges the whole representation family as required by Workers Cacheworkers_dev, basePath, trailingSlash, and deployment ID; wildcard hosts cannot be enumerated and exact non-wildcard routes intentionally cannot receive query-bearing RSC/probe requestsRequest and behavior implications
Next-Url,Next-Router-State-Tree, prefetch/segment-prefetch, mounted-slot, and interception headers. Their completed payload is proven source-independent, so those headers would only fragment the shared cache.CookieandAuthorizationrequests remainno-store/isolated.Hostand scheme are explicitVarydimensions because Workers Cache's base key is path/query/version rather than hostname or protocol.Varyfamily.Validation
vp run vinext#buildvp run @vinext/cloudflare#buildknip, and diff checks are clean/bigbonk: no remaining blockers; one timeout/body-drain finding was fixed and independently re-reviewed clean