-
Notifications
You must be signed in to change notification settings - Fork 28.9k
Open
Labels
RedirectsRelated to redirecting.Related to redirecting.
Description
Link to the code that reproduces this issue
https://github.com/hdodov/test-nextjs/tree/bug-redirects-case-insensitive
To Reproduce
pnpm dev
- Open http://localhost:3000/foo-Bar
- 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…
yonislavdochev, stananiev, shaferova, todor0v and masonmcelvain
Metadata
Metadata
Assignees
Labels
RedirectsRelated to redirecting.Related to redirecting.