mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #762] [MERGED] fix: apply middleware headers to intercept route and server action responses #825
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#825
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/762
Author: @NathanDrake2406
Created: 4/3/2026
Status: ✅ Merged
Merged: 4/3/2026
Merged by: @james-elicx
Base:
main← Head:fix/middleware-headers-intercept-action📝 Commits (3)
9027123fix: apply middleware headers to intercept route and server action responsesd0bf61afix: merge middleware headers before x-action-redirect control headersc89252afix: update RSC entry snapshots for middleware headers📊 Changes
6 files changed (+260 additions, -77 deletions)
View changed files
📝
packages/vinext/src/entries/app-rsc-entry.ts(+20 -9)📝
packages/vinext/src/server/app-page-response.ts(+29 -14)📝
tests/__snapshots__/entry-templates.test.ts.snap(+114 -54)📝
tests/app-page-response.test.ts(+45 -0)📝
tests/app-router.test.ts(+50 -0)📝
tests/fixtures/app-basic/middleware.ts(+2 -0)📄 Description
Summary
_mwCtx.headers) were silently dropped on three code paths: intercepting route responses, server action re-render responses, and server action redirect responsesResponseobjects directly without merging middleware headers, unlike the normal page path which goes throughbuildAppPageRscResponse()mergeMiddlewareResponseHeaders()frombuildAppPageRscResponse()and applied it to all three paths, plus refactored the original caller to use the shared helperTest plan
mergeMiddlewareResponseHeadershelper (null-safe, Set-Cookie/Vary append, other headers set)mergeMiddlewareResponseHeadersis called in intercept, action re-render, and action redirect paths🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.