Skip to content

feat(cloudflare): isolate cached response entrypoint - #3152

Draft
james-elicx wants to merge 14 commits into
codex/cdn-v2-prerender-stagesfrom
codex/cdn-v2-cloudflare-entrypoints
Draft

feat(cloudflare): isolate cached response entrypoint#3152
james-elicx wants to merge 14 commits into
codex/cdn-v2-prerender-stagesfrom
codex/cdn-v2-cloudflare-entrypoints

Conversation

@james-elicx

@james-elicx james-elicx commented Sep 2, 2026

Copy link
Copy Markdown
Member

Part 12 of 16 in the staged CDN adapter stack. Depends on #3151.

Summary

  • makes the Cloudflare CDN adapter select an uncached gateway plus a named cached-response Worker entrypoint
  • keeps middleware and request-time personalization in the gateway while eligible renders use Workers Cache
  • lazy-loads application rendering only on cache miss
  • partitions the opaque cache URL by authority, authorization, build, invocation, and raw framework RSC selectors
  • authenticates shared-response provenance through outer header composition and fails closed on reserved-header collisions
  • mirrors the response entrypoint's CF-Cache-Status into X-Vinext-Cache and X-Nextjs-Cache only at final gateway egress

Validation

  • 50/50 Cloudflare Worker entrypoint tests
  • focused Cloudflare adapter, admission, build, and gateway-collision coverage
  • fixture coverage includes App/Pages, middleware headers/cookies, draft mode, Vary, late stream failure, revalidation, HEAD, and route handlers

Review size

  • Implementation: +794 / -71 LOC
  • Tests and fixtures: +2058 / -111 LOC
  • Other (docs, config, lockfile): +2 / -0 LOC
  • 32 changed files

Measured against codex/cdn-v2-prerender-stages after rebasing onto main@a6931c0.

@pkg-pr-new

pkg-pr-new Bot commented Sep 2, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@vinext/cloudflare@3152
npm i https://pkg.pr.new/create-vinext-app@3152
npm i https://pkg.pr.new/@vinext/types@3152
npm i https://pkg.pr.new/vinext@3152

commit: 792bf69

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Performance benchmarks

Compared 792bf69 against base 674df1d using alternating same-runner rounds. Next.js was unchanged and skipped.

0 improved · 0 regressed · 6 within ±1.5%

Scenario Framework Baseline Current Change
Client bundle size (gzip) vinext 142.3 KB 142.3 KB ⚫ -0.0%
Client entry size (gzip) vinext 129.6 KB 129.6 KB ⚫ -0.0%
Dev server cold start vinext 3.40 s 3.38 s ⚫ -0.6%
Production build time vinext 3.50 s 3.53 s ⚫ +0.8%
RSC entry closure size (gzip) vinext 125.6 KB 125.6 KB ⚫ -0.0%
Server bundle size (gzip) vinext 216.4 KB 216.4 KB ⚫ -0.0%

View detailed results and traces

🟢 improvement · 🔴 regression · ⚫ change below 1.5% · paired base/head

@james-elicx
james-elicx force-pushed the codex/cdn-v2-cloudflare-entrypoints branch from 221ac06 to 9eb327f Compare September 2, 2026 10:25
@james-elicx
james-elicx force-pushed the codex/cdn-v2-cloudflare-entrypoints branch from 9eb327f to f683223 Compare September 2, 2026 12:47
@james-elicx
james-elicx force-pushed the codex/cdn-v2-cloudflare-entrypoints branch from f683223 to 25ffb33 Compare September 2, 2026 13:41
@james-elicx
james-elicx force-pushed the codex/cdn-v2-cloudflare-entrypoints branch from 25ffb33 to 1c47c31 Compare September 2, 2026 14:16
@james-elicx
james-elicx force-pushed the codex/cdn-v2-cloudflare-entrypoints branch 2 times, most recently from 2a9ba89 to adcd103 Compare September 2, 2026 15:21
@james-elicx
james-elicx force-pushed the codex/cdn-v2-cloudflare-entrypoints branch from adcd103 to 4d08650 Compare September 2, 2026 15:27
@james-elicx
james-elicx force-pushed the codex/cdn-v2-cloudflare-entrypoints branch from 4d08650 to 75b3a96 Compare September 2, 2026 15:36
@james-elicx
james-elicx force-pushed the codex/cdn-v2-cloudflare-entrypoints branch from 75b3a96 to a5b4d7c Compare September 2, 2026 15:41
@james-elicx
james-elicx force-pushed the codex/cdn-v2-cloudflare-entrypoints branch from a5b4d7c to c1219d4 Compare September 2, 2026 16:26
@james-elicx
james-elicx force-pushed the codex/cdn-v2-cloudflare-entrypoints branch from c1219d4 to 996256e Compare September 2, 2026 16:32
@james-elicx
james-elicx force-pushed the codex/cdn-v2-cloudflare-entrypoints branch from 996256e to 16189ec Compare September 2, 2026 16:37
@james-elicx
james-elicx force-pushed the codex/cdn-v2-cloudflare-entrypoints branch from 16189ec to 1708698 Compare September 2, 2026 16:46
@james-elicx
james-elicx force-pushed the codex/cdn-v2-cloudflare-entrypoints branch from 1708698 to 7287eef Compare September 2, 2026 17:12
@james-elicx
james-elicx force-pushed the codex/cdn-v2-cloudflare-entrypoints branch from 7287eef to b9ab9cd Compare September 2, 2026 18:46
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor
Example Preview Production Original
app-router-cloudflare preview production
pages-router-cloudflare preview production
app-router-playground preview production original
realworld-api-rest preview production
nextra-docs-template preview production
benchmarks preview production
hackernews preview production original
workers-cache preview production
static-export preview production
web preview production

@james-elicx
james-elicx force-pushed the codex/cdn-v2-cloudflare-entrypoints branch from 562d43f to e91dec5 Compare September 7, 2026 09:22
@james-elicx
james-elicx force-pushed the codex/cdn-v2-cloudflare-entrypoints branch from e91dec5 to 792bf69 Compare September 7, 2026 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant