Skip to content

Request URLs are normalized in adapter despite __NEXT_NO_MIDDLEWARE_URL_NORMALIZE #87779

@vincent-turato

Description

@vincent-turato

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Linking and NavigatingRelated to Next.js linking (e.g., <Link>) and navigation.MiddlewareRelated to Next.js Middleware.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions