Repository navigation
fix(language-selector): ignore the origin when checking the canonical URL - #2282
Merged
Merged
Conversation
… URL Since 8ef21bb regular pages carry an absolute self-referencing canonical, and since 7d04391 the canonical guard compares origin and pathname. Together they redirect any regular page served from a host other than the baseURL to the baseURL host. This breaks hosts that legitimately serve the same build, such as the CloudCannon visual editor (pages load from a *.proxy.cloudcannon.com origin and are bounced before the editor can initialize) and deploy previews. Compare the pathname only. The guard exists for alias pages, whose pathname differs from the canonical one, so they keep redirecting. The query string and hash handling (7d04391) and the case-insensitive comparison (904763f) are unchanged. Before 8ef21bb regular pages had no canonical and never redirected across hosts, so this restores that behavior. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
✅ Deploy Preview for gethinode-demo ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
markdumay
enabled auto-merge
October 28, 2026 11:47
Collaborator
Author
|
🎉 This PR is included in version 3.45.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Regular pages emit an absolute self-referencing canonical (8ef21bb), and the language selector redirects whenever origin or pathname differ from it (7d04391). Any regular page served from a host other than the
baseURLis therefore bounced to thebaseURLhost.Observed in the CloudCannon visual editor: pages load from a
*.proxy.cloudcannon.comorigin, the script redirects the preview iframe away, and the editor hangs on "Initializing editor..." without any console error. Section pages (no canonical) were unaffected. Deploy previews on another host are affected the same way.Change
Compare the pathname only. The guard exists for alias pages, whose pathname differs from the canonical, so those still redirect. Query string and hash handling (7d04391) and the case-insensitive comparison (904763f) are unchanged.
Verification
Bundled
languageSelector.jswith esbuild (@paramsstubbed, selector enabled) and ran it in jsdom, againstmain(control) and this branch:?utm_source=x#aAlso validated downstream on squadra.nl's CloudCannon site with an equivalent override: the visual editor initializes again.
npm run lint:scriptspasses.🤖 Generated with Claude Code