Skip to content

Redirects in next.config.ts are case-insensitive and lead to ERR_TOO_MANY_REDIRECTS in Next.js 15 #80578

@hdodov

Description

@hdodov

Link to the code that reproduces this issue

https://github.com/hdodov/test-nextjs/tree/bug-redirects-case-insensitive

To Reproduce

  1. pnpm dev
  2. Open http://localhost:3000/foo-Bar
  3. You'll get ERR_TOO_MANY_REDIRECTS in the browser

Current vs. Expected behavior

Currently: If you have a page /foo-bar, /foo-Bar will be a 404. But when you add the following redirect:

{
  source: "/foo-Bar",
  destination: "/foo-bar",
  permanent: true,
}

…you get an infinite redirect chain, because /foo-Bar redirects to /foo-bar and then /foo-bar redirects to /foo-bar again.

Expected: The redirect should be case-sensitive and only /foo-Bar (with a capital B) should lead to a redirect.

Provide environment information

Operating System:
  Platform: darwin
  Arch: x64
  Version: Darwin Kernel Version 23.6.0: Thu Apr 24 20:26:36 PDT 2025; root:xnu-10063.141.1.705.2~1/RELEASE_X86_64
  Available memory (MB): 32768
  Available CPU cores: 16
Binaries:
  Node: 20.17.0
  npm: 10.8.2
  Yarn: N/A
  pnpm: 10.4.1
Relevant Packages:
  next: 15.3.3 // Latest available version is detected (15.3.3).
  eslint-config-next: 15.3.3
  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)

Redirects

Which stage(s) are affected? (Select all that apply)

next start (local)

Additional context

I need this redirect for SEO purposes, as having 404 pages not your site is a bad SEO signal. However, "fixing" this with a redirect causes an infinite redirect chain, which is worse…

Metadata

Metadata

Assignees

No one assigned

    Labels

    RedirectsRelated to redirecting.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions