mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #817] [CLOSED] fix: apply middleware request-header overrides before App->Pages fallback #868
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#868
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/817
Author: @southpolesteve
Created: 4/10/2026
Status: ❌ Closed
Base:
main← Head:fix/app-pages-fallback-sees-middleware-overrides-v2📝 Commits (2)
4f016bffix: apply middleware request-header overrides before App->Pages fallback3182d82fix: rebuild App->Pages fallback request with middleware overrides and regen snapshots📊 Changes
3 files changed (+43 additions, -1 deletions)
View changed files
📝
packages/vinext/src/entries/app-rsc-entry.ts(+18 -1)📝
tests/__snapshots__/entry-templates.test.ts.snap(+6 -0)📝
tests/app-router.test.ts(+19 -0)📄 Description
Summary
In mixed App+Pages projects, the App Router production fallback now rebuilds the request from middleware request-header overrides before delegating to Pages SSR.
Details
Middleware request-header overrides were already applied to:
But the App Router production fallback still delegated to
renderPage()with the originalRequestobject. That meant a Pages route reached via App->Pages fallback could still see the originalAuthorization/Cookieheaders ingetServerSideProps, even when middleware had deleted them and injected trusted replacement headers.This change:
buildRequestHeadersFromMiddlewareResponse()using the preserved middleware request-header payloadrenderPage()middlewareHeadersparameterTests
Adds a production-only regression test verifying that
/pages-header-override-deletein a mixed App+Pages project sees:authorization: nullcookie: nullx-from-middleware: hello-from-middlewarebefore
getServerSidePropsruns.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.