mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #40] [CLOSED] fix: include /api routes in default middleware matcher #261
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#261
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/40
Author: @SeolJaeHyeok
Created: 2/25/2026
Status: ❌ Closed
Base:
main← Head:fix/middleware-api-default-exclusion📝 Commits (1)
878d7a0fix: include /api routes in default middleware matcher📊 Changes
2 files changed (+6 additions, -5 deletions)
View changed files
📝
packages/vinext/src/server/middleware.ts(+2 -2)📝
tests/shims.test.ts(+4 -3)📄 Description
Intro
Before reviewing this PR, I have a quick question. I've modified the default behavior of
matchesMiddlewareso that middleware is now applied to/apiroutes by default.Was the previous behavior—excluding
/apiroutes by default—an intentional design choice for this project?Summary
matchesMiddlewarebehaviour (nomatcherconfig) was incorrectly excluding/api-prefixed routes from middleware execution/api— only/_nextinternals, static files (paths with a file extension), and/favicon.icoare excluded/apiChanged files:
packages/vinext/src/server/middleware.ts— removed!pathname.startsWith("/api")from the no-matcher default, updated commenttests/shims.test.ts— updated test assertions to reflect correct Next.js-compatible behaviour (/api/helloand/api/users/123now expected to returntrue)Test plan
pnpm testpasses — all middleware matcher pattern tests updated and greenReferences
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.