[PR #301] [MERGED] Revert "Rebuild request context after middleware modifies headers" #456

Closed
opened 2026-05-06 12:39:53 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/301
Author: @james-elicx
Created: 3/6/2026
Status: Merged
Merged: 3/6/2026
Merged by: @southpolesteve

Base: mainHead: revert-288-fix/refresh-request-context-after-middleware


📝 Commits (2)

  • 82da8af Revert "Rebuild request context after middleware modifies headers (#288)"
  • 070a03b change test into a regression test

📊 Changes

4 files changed (+9 additions, -24 deletions)

View changed files

📝 packages/vinext/src/deploy.ts (+2 -9)
📝 packages/vinext/src/server/prod-server.ts (+2 -10)
📝 tests/fixtures/pages-basic/middleware.ts (+2 -2)
📝 tests/pages-router.test.ts (+3 -3)

📄 Description

Based on what the Next.js docs describe, I believe that behaviour is the opposite to how Next.js work.

https://nextjs.org/docs/14/pages/building-your-application/routing/middleware#matching-paths

The docs state that the config's headers and redirects are evaluated before the middleware, which suggests that #288 enabling them to be evaluated after is the incorrect behaviour.

Does not revert the unpacking of x-middleware-request-* headers as that sounds reasonable.


🔄 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/301 **Author:** [@james-elicx](https://github.com/james-elicx) **Created:** 3/6/2026 **Status:** ✅ Merged **Merged:** 3/6/2026 **Merged by:** [@southpolesteve](https://github.com/southpolesteve) **Base:** `main` ← **Head:** `revert-288-fix/refresh-request-context-after-middleware` --- ### 📝 Commits (2) - [`82da8af`](https://github.com/cloudflare/vinext/commit/82da8af4fd0a33e418deeb0a907d4e07b6ff7e4f) Revert "Rebuild request context after middleware modifies headers (#288)" - [`070a03b`](https://github.com/cloudflare/vinext/commit/070a03bdba86432dadcbee256861baf5781465cb) change test into a regression test ### 📊 Changes **4 files changed** (+9 additions, -24 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/deploy.ts` (+2 -9) 📝 `packages/vinext/src/server/prod-server.ts` (+2 -10) 📝 `tests/fixtures/pages-basic/middleware.ts` (+2 -2) 📝 `tests/pages-router.test.ts` (+3 -3) </details> ### 📄 Description Based on what the Next.js docs describe, I believe that behaviour is the opposite to how Next.js work. https://nextjs.org/docs/14/pages/building-your-application/routing/middleware#matching-paths The docs state that the config's `headers` and `redirects` are evaluated before the middleware, which suggests that #288 enabling them to be evaluated after is the incorrect behaviour. Does not revert the unpacking of `x-middleware-request-*` headers as that sounds reasonable. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 12:39:53 +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#456
No description provided.