Incorrect Location header URL with domain routing i18n #68388
Labels
bug
Issue was opened via the bug report template.
Internationalization (i18n)
Related to Internationalization with Next.js.
Middleware
Related to Next.js Middleware.
Navigation
Related to Next.js linking (e.g., <Link>) and navigation.
Link to the code that reproduces this issue
https://github.com/SLMNBJ/nextjs-domain-routing-redirect
To Reproduce
npm run dev
Current vs. Expected behavior
Current:
Next.js redirects to the wrong hostname. Location header URL uses the matched
defaultLocale
domain fromi18n.domains
to prefix the URLExpected behavior:
Next.js location header should use the current hostname I'm navigating for the location header. If I click http://localhost:3000/fr/will-be-removed/blog I expect to be http://localhost:3000/fr/blog
Provide environment information
Node.js v18.20.3 Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 23.6.0: Fri Jul 5 17:56:41 PDT 2024; root:xnu-10063.141.1~2/RELEASE_ARM64_T6000 Available memory (MB): 16384 Available CPU cores: 10 Binaries: Node: 18.20.3 npm: 10.7.0 Yarn: 1.22.19 pnpm: N/A Relevant Packages: next: 14.2.5 // Latest available version is detected (14.2.5). eslint-config-next: 14.2.5 react: 18.3.1 react-dom: 18.3.1 typescript: 5.5.4 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
Internationalization (i18n), Middleware, Navigation
Which stage(s) are affected? (Select all that apply)
next dev (local), next start (local)
Additional context
I have multiple environments with different domains. I use Domain Routing i18n to configure each domain's locale and add redirects to redirect old URLs to new ones.
The text was updated successfully, but these errors were encountered: