Skip to content

Encoding issue with middleware rewrites and search params #79195

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
amannn opened this issue May 14, 2025 · 0 comments
Open

Encoding issue with middleware rewrites and search params #79195

amannn opened this issue May 14, 2025 · 0 comments
Labels
Middleware Related to Next.js Middleware.

Comments

@amannn
Copy link
Contributor

amannn commented May 14, 2025

Link to the code that reproduces this issue

amannn/nextjs-bug-repro-middleware-encoding@cdf1f30

To Reproduce

  1. Deploy https://github.com/amannn/nextjs-bug-repro-middleware-encoding/ on Vercel
  2. Open the app with ?sélectionnez+votre in the pathname

Example deployment: https://nextjs-bug-repro-middleware-encoding.vercel.app/?s%C3%A9lectionnez+votre

Current vs. Expected behavior

Errors from Vercel:

500: INTERNAL_SERVER_ERROR
Code: MIDDLEWARE_INVOCATION_FAILED
ID: fra1::fvjhx-1747217023943-0c711de933e3
Vercel Runtime Malformed Response Header Error: Header 'x-middleware-rewrite: /test?s%C3%A9lectionner+votre' contains non-ASCII characters.

I'd expect the app to work.

Provide environment information

Operating System:
  Platform: darwin
  Arch: x64
  Version: Darwin Kernel Version 23.6.0: Mon Jul 29 21:13:00 PDT 2024; root:xnu-10063.141.2~1/RELEASE_X86_64
  Available memory (MB): 16384
  Available CPU cores: 12
Binaries:
  Node: 20.11.1
  npm: 10.2.4
  Yarn: 1.22.22
  pnpm: 9.15.4
Relevant Packages:
  next: 15.4.0-canary.34 // Latest available version is detected (15.4.0-canary.34).
  eslint-config-next: 15.4.0-canary.34
  react: 19.1.0
  react-dom: 19.1.0
  typescript: 5.8.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)

Vercel (Deployed)

Additional context

No response

@github-actions github-actions bot added the Middleware Related to Next.js Middleware. label May 14, 2025
@amannn amannn changed the title Encoding issue with middleware rewrites Encoding issue with middleware rewrites and search params May 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Middleware Related to Next.js Middleware.
Projects
None yet
Development

No branches or pull requests

1 participant