mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #102] [MERGED] fix: normalize request pathname before middleware and route matching #311
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#311
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/102
Author: @southpolesteve
Created: 2/26/2026
Status: ✅ Merged
Merged: 2/26/2026
Merged by: @southpolesteve
Base:
main← Head:fix/middleware-path-normalization📝 Commits (2)
baff6f8fix: normalize request pathname before middleware and route matching7fa1801fix: restore tryServeStatic call for App Router static assets📊 Changes
8 files changed (+531 additions, -223 deletions)
View changed files
📝
packages/vinext/src/index.ts(+19 -103)📝
packages/vinext/src/server/app-dev-server.ts(+15 -90)📝
packages/vinext/src/server/app-router-entry.ts(+18 -4)➕
packages/vinext/src/server/middleware-codegen.ts(+186 -0)📝
packages/vinext/src/server/middleware.ts(+9 -8)➕
packages/vinext/src/server/normalize-path.ts(+54 -0)📝
packages/vinext/src/server/prod-server.ts(+11 -10)📝
tests/shims.test.ts(+219 -8)📄 Description
Summary
normalizePathutility that collapses consecutive slashes (//foo///bar->/foo/bar), resolves.and..segments, and ensures a leading slashdecodeURIComponent+normalizePathbefore middleware matching and route matching in all entry points (dev server, prod server, Cloudflare Worker entry, codegen entries)middleware-codegen.ts) as single source of truth for pattern matching logic, replacing hand-copied inline implementations inindex.tsandapp-dev-server.tstruewhen no matcher is configured, matching Next.js behavior/((?!api|_next).*)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.