Enforcing middleware config.matcher to start with '/' and basePath to not end with '/' makes it impossible to handle the index page in middleware #77385
Labels
Middleware
Related to Next.js Middleware.
Link to the code that reproduces this issue
https://codesandbox.io/p/devbox/vigorous-maria-t7s3qz?workspaceId=ws_AWWZp8c7McmrRVKgiL4pAk
To Reproduce
Middleware will print the request path in the console.
Base path is set to
/test
Current vs. Expected behavior
When accessing
/test
:current: the request is not handled by the middleware.
expected: the request should be handled by the middleware.
And I cannot include
[""]
in the matcher, which will shutdown the server at once.Provide environment information
Version: #1 SMP PREEMPT_DYNAMIC Sun Aug 6 20:05:33 UTC 2023 Available memory (MB): 4242 Available CPU cores: 2 Binaries: Node: 20.9.0 npm: 9.8.1 Yarn: 1.22.19 pnpm: 8.10.2 Relevant Packages: next: 15.3.0-canary.17 // Latest available version is detected (15.3.0-canary.17). eslint-config-next: N/A react: 19.0.0 react-dom: 19.0.0 typescript: 5.1.3 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
Middleware
Which stage(s) are affected? (Select all that apply)
next dev (local), next build (local), next start (local), Vercel (Deployed), Other (Deployed)
Additional context
No response
The text was updated successfully, but these errors were encountered: