[PR #983] [MERGED] refactor: Extract early config header and public file pipeline #999

Closed
opened 2026-05-06 13:11:29 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/983
Author: @NathanDrake2406
Created: 4/30/2026
Status: Merged
Merged: 4/30/2026
Merged by: @james-elicx

Base: mainHead: nathan/config-header-public-early-pipeline


📝 Commits (1)

  • 1bbf648 refactor: extract early request pipeline helpers

📊 Changes

9 files changed (+427 additions, -316 deletions)

View changed files

📝 packages/vinext/package.json (+4 -0)
📝 packages/vinext/src/deploy.ts (+6 -21)
📝 packages/vinext/src/entries/app-rsc-entry.ts (+16 -38)
📝 packages/vinext/src/server/prod-server.ts (+6 -22)
📝 packages/vinext/src/server/request-pipeline.ts (+138 -4)
📝 tests/__snapshots__/entry-templates.test.ts.snap (+96 -228)
📝 tests/app-router.test.ts (+1 -1)
📝 tests/deploy.test.ts (+4 -2)
📝 tests/request-pipeline.test.ts (+156 -0)

📄 Description

Summary

  • Move next.config.js header application into request-pipeline helpers for both Web Headers and early header records.
  • Move App Router public-file static response resolution into request-pipeline, leaving generated RSC entry code to describe app shape and route manifests.
  • Reuse the same config-header helper from the Pages production server and generated Pages Worker entry; export vinext/server/request-pipeline for generated worker code.
  • Add focused tests for original-request matcher context, middleware/config header precedence, multi-value header appends, and public-file routing policy.

Next.js references

Vinext should keep the route policy aligned with Next.js while keeping behavior out of generated templates:

Tests

  • vp test run tests/request-pipeline.test.ts
  • vp test run tests/app-router.test.ts -t "custom header handling|empty config arrays|rewrite handling code|config pattern"
  • vp test run tests/deploy.test.ts -t "next.config.js custom headers|next.config.js redirects|next.config.js rewrites|basePath stripping"
  • vp test run tests/request-pipeline.test.ts tests/deploy.test.ts
  • vp test run tests/app-router.test.ts -t "custom headers from next.config.js|serves public files from the build output|serves public files under basePath|App Router next.config.js features"
  • vp test run tests/entry-templates.test.ts
  • vp fmt --check packages/vinext/src/server/request-pipeline.ts packages/vinext/src/entries/app-rsc-entry.ts packages/vinext/src/server/prod-server.ts packages/vinext/src/deploy.ts tests/request-pipeline.test.ts tests/app-router.test.ts tests/deploy.test.ts packages/vinext/package.json
  • vp check
  • vp run vinext#build

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/cloudflare/vinext/pull/983 **Author:** [@NathanDrake2406](https://github.com/NathanDrake2406) **Created:** 4/30/2026 **Status:** ✅ Merged **Merged:** 4/30/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `main` ← **Head:** `nathan/config-header-public-early-pipeline` --- ### 📝 Commits (1) - [`1bbf648`](https://github.com/cloudflare/vinext/commit/1bbf6483f51cc1f1ea0304a5a19044fadd3aca46) refactor: extract early request pipeline helpers ### 📊 Changes **9 files changed** (+427 additions, -316 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/package.json` (+4 -0) 📝 `packages/vinext/src/deploy.ts` (+6 -21) 📝 `packages/vinext/src/entries/app-rsc-entry.ts` (+16 -38) 📝 `packages/vinext/src/server/prod-server.ts` (+6 -22) 📝 `packages/vinext/src/server/request-pipeline.ts` (+138 -4) 📝 `tests/__snapshots__/entry-templates.test.ts.snap` (+96 -228) 📝 `tests/app-router.test.ts` (+1 -1) 📝 `tests/deploy.test.ts` (+4 -2) 📝 `tests/request-pipeline.test.ts` (+156 -0) </details> ### 📄 Description ## Summary - Move `next.config.js` header application into `request-pipeline` helpers for both Web `Headers` and early header records. - Move App Router public-file static response resolution into `request-pipeline`, leaving generated RSC entry code to describe app shape and route manifests. - Reuse the same config-header helper from the Pages production server and generated Pages Worker entry; export `vinext/server/request-pipeline` for generated worker code. - Add focused tests for original-request matcher context, middleware/config header precedence, multi-value header appends, and public-file routing policy. ## Next.js references Vinext should keep the route policy aligned with Next.js while keeping behavior out of generated templates: - Next.js documents the request order as `headers`, `redirects`, proxy/middleware, `beforeFiles`, then filesystem routes including `public/`: https://github.com/vercel/next.js/blob/canary/docs/01-app/03-api-reference/03-file-conventions/proxy.mdx - Next.js `resolve-routes.ts` models that same order with `fsChecker.headers`, `fsChecker.redirects`, middleware, `rewrites.beforeFiles`, and filesystem checks: https://github.com/vercel/next.js/blob/canary/packages/next/src/server/lib/router-utils/resolve-routes.ts - The redirects docs explicitly call out that redirects are checked before filesystem routes, including `/public` files: https://github.com/vercel/next.js/blob/canary/docs/01-app/03-api-reference/05-config/01-next-config-js/redirects.mdx - Next.js filesystem routing handles public/static asset matching in `filesystem.ts`: https://github.com/vercel/next.js/blob/canary/packages/next/src/server/lib/router-utils/filesystem.ts - Next.js integration coverage includes public files after rewrites and public-file precedence over dynamic routes: https://github.com/vercel/next.js/blob/canary/test/integration/custom-routes/test/index.test.ts and https://github.com/vercel/next.js/blob/canary/test/integration/dynamic-routing/test/index.test.ts ## Tests - `vp test run tests/request-pipeline.test.ts` - `vp test run tests/app-router.test.ts -t "custom header handling|empty config arrays|rewrite handling code|config pattern"` - `vp test run tests/deploy.test.ts -t "next.config.js custom headers|next.config.js redirects|next.config.js rewrites|basePath stripping"` - `vp test run tests/request-pipeline.test.ts tests/deploy.test.ts` - `vp test run tests/app-router.test.ts -t "custom headers from next.config.js|serves public files from the build output|serves public files under basePath|App Router next.config.js features"` - `vp test run tests/entry-templates.test.ts` - `vp fmt --check packages/vinext/src/server/request-pipeline.ts packages/vinext/src/entries/app-rsc-entry.ts packages/vinext/src/server/prod-server.ts packages/vinext/src/deploy.ts tests/request-pipeline.test.ts tests/app-router.test.ts tests/deploy.test.ts packages/vinext/package.json` - `vp check` - `vp run vinext#build` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:11:29 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#999
No description provided.