mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #188] [MERGED] Fix Pages prod middleware named proxy export resolution #375
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#375
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/188
Author: @pomarie
Created: 2/28/2026
Status: ✅ Merged
Merged: 2/28/2026
Merged by: @southpolesteve
Base:
main← Head:fix/proxy-named-export-pages-prod📝 Commits (2)
f25d59afix pages prod middleware named proxy export2a7ecc5remove security remediation report from PR📊 Changes
5 files changed (+162 additions, -4 deletions)
View changed files
📝
packages/vinext/src/index.ts(+1 -1)📝
packages/vinext/src/server/middleware.ts(+2 -2)📝
tests/app-router.test.ts(+7 -1)📝
tests/pages-router.test.ts(+128 -0)📝
tests/shims.test.ts(+24 -0)📄 Description
summary
we found a production-only mismatch in how vinext runs
proxy.tsfor Pages Router apps.if an app exported
proxy.tsasexport function proxy(...)(named export), the generated production middleware runner ignored it and acted like no middleware existed. this means requests could continue straight to routes that were expected to be gated by proxy logic.why this is a problem
teams commonly put auth/authz checks in
proxy.ts(redirect unauthenticated users, block private paths, tenant checks, etc).before this fix, those checks could silently not run in Pages production output when using named
proxy. that is teh dangerous part: no crash, just skipped protection.why lowercase
proxywe resolve the export by exact name, and JavaScript export names are case-sensitive. Next.js 16 also documents/uses
proxyin lowercase. soproxymust be matched exactly;ProxyorPROXYare different identifiers.what changed
default || proxy || middlewareproxysupportproxyexecution in generated Pages prod entrydefault > proxy > middleware)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.