Request URLs are normalized in adapter despite __NEXT_NO_MIDDLEWARE_URL_NORMALIZE
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 142k
- Forks
- 32.4k
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 351
Description
Link to the code that reproduces this issue
https://codesandbox.io/p/devbox/fancy-shadow-gy6w5s
To Reproduce
- Open the linked CodeSandbox (the dev server already runs with __NEXT_NO_MIDDLEWARE_URL_NORMALIZE=1).
- Manually request a .rsc URL in the browser or via curl, for example:
- http://localhost:3000/test.rsc
- Observe the server logs from proxy.ts.
Current vs. Expected behavior
- Expected: With __NEXT_NO_MIDDLEWARE_URL_NORMALIZE=1, the proxy/middleware should receive the raw path /test.rsc.
- Actual: The request is normalized to /test before reaching proxy.ts (visible in logs), even though normalization is disabled. A 404 response is expected, but the URL mutation still occurs.
Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #37~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Nov 20 10:25:38 UTC 2
Available memory (MB): 23956
Available CPU cores: 16
Binaries:
Node: 22.19.0
npm: 10.9.3
Yarn: N/A
pnpm: 10.26.2
Relevant Packages:
next: 16.1.1-canary.5 // Latest available version is detected (16.1.1-canary.5).
eslint-config-next: N/A
react: 19.2.3
react-dom: 19.2.3
typescript: 5.9.3
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
Middleware, Linking and Navigating
Which stage(s) are affected? (Select all that apply)
Vercel (Deployed), next start (local), next build (local), next dev (local), Other (Deployed)
Additional context
The request URL is normalized (specifically, the .rsc suffix is stripped) in the web adapter before middleware or proxy handlers are invoked, which makes the normalization opt-out ineffective. As a result, both App Router and Pages Router flows observe normalized paths even when __NEXT_NO_MIDDLEWARE_URL_NORMALIZE=1, which can be reproduced by manually requesting a .rsc path (404 expected).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked CodeSandbox and reproduce a request to /test.rsc with __NEXT_NO_MIDDLEWARE_URL_NORMALIZE=1, then inspect the web adapter path before proxy.ts is invoked. Done means proxy.ts receives the raw /test.rsc path while the expected 404 behavior remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- next.js
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100