[PR #600] [CLOSED] fix: use post-middleware request context for config header matching #701

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

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/600
Author: @southpolesteve
Created: 3/20/2026
Status: Closed

Base: mainHead: fix/use-post-middleware-context-for-headers


📄 Description

Summary

One-line fix: config header has/missing conditions now evaluate against the post-middleware request context instead of the pre-middleware one.

Details

The matchHeaders() call in the Pages Router production server was using reqCtx (computed before middleware runs) instead of postMwReqCtx (rebuilt after middleware request header overrides are applied). This meant if middleware modified headers or cookies, those changes were not visible to has/missing conditions on config header rules.

Rewrites (beforeFiles, afterFiles, fallback) already used postMwReqCtx correctly. This brings config header matching in line with that behavior.


🔄 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/600 **Author:** [@southpolesteve](https://github.com/southpolesteve) **Created:** 3/20/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/use-post-middleware-context-for-headers` --- ### 📄 Description ## Summary One-line fix: config header `has`/`missing` conditions now evaluate against the post-middleware request context instead of the pre-middleware one. ## Details The `matchHeaders()` call in the Pages Router production server was using `reqCtx` (computed before middleware runs) instead of `postMwReqCtx` (rebuilt after middleware request header overrides are applied). This meant if middleware modified headers or cookies, those changes were not visible to `has`/`missing` conditions on config header rules. Rewrites (`beforeFiles`, `afterFiles`, `fallback`) already used `postMwReqCtx` correctly. This brings config header matching in line with that behavior. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:09:39 +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#701
No description provided.