vercel / vercel/next.js

Request URLs are normalized in adapter despite __NEXT_NO_MIDDLEWARE_URL_NORMALIZE

Open
#87,779 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Linking and Navigating Middleware
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
  1. Open the linked CodeSandbox (the dev server already runs with __NEXT_NO_MIDDLEWARE_URL_NORMALIZE=1).
  2. Manually request a .rsc URL in the browser or via curl, for example:
  3. http://localhost:3000/test.rsc
  4. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.