mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #813] [MERGED] fix: apply middleware request-header overrides before App->Pages fallback #864
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#864
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/813
Author: @southpolesteve
Created: 4/10/2026
Status: ✅ Merged
Merged: 4/10/2026
Merged by: @southpolesteve
Base:
main← Head:fix/app-pages-fallback-sees-middleware-overrides📝 Commits (2)
0fc731bfix: apply middleware request-header overrides before App->Pages fallbackc9bcc83test: regenerate App Router entry snapshots for middleware fallback fix📊 Changes
3 files changed (+42 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(+18 -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()middlewareHeadersparameter as beforeTests
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.
runWith*return type when callback is async #905