Skip to content
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

Fix: domain routing redirects #75115

Open
wants to merge 3 commits into
base: canary
Choose a base branch
from

Conversation

SalmenBejaoui
Copy link

What?

This PR aims to fix a redirection issue when domain routing and redirect rules are used together in next.config.js.
This generates rules with absolute URLs, redirecting the request to an incorrect domain and a different host from where it came from.

How to replicate?

  • add a domain route configuration to test/e2e/i18n-default-locale-redirect/app/next.config.js
  • test fails
image



Screenshot 2025-01-20 at 19 52 14
I'm navigating localhost, but once the redirection matches, I get redirected to example.nl as it's the first matched rule. I expect to be redirected `/nl/new` keeping the same host.

How to fix?

Avoid adding domain routing to redirects array fixes the issue.

Tests added.

Fixes #68388

@ijjk
Copy link
Member

ijjk commented Jan 20, 2025

Allow CI Workflow Run

  • approve CI run for commit: 6d694ef

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect Location header URL with domain routing i18n
2 participants