Skip to content

fix: shouldSkipRedirect incorrectly skips cross-domain redirects#942

Open
devinle wants to merge 1 commit intodevelopfrom
fix/cross-domain-redirect-skip
Open

fix: shouldSkipRedirect incorrectly skips cross-domain redirects#942
devinle wants to merge 1 commit intodevelopfrom
fix/cross-domain-redirect-skip

Conversation

@devinle
Copy link

@devinle devinle commented Feb 2, 2026

Summary

  • Adds host comparison check in shouldSkipRedirect to ensure cross-domain redirects are never skipped
  • Fixes an issue where redirects configured from one domain to another with the same pathname would result in 404 errors instead of proper redirects

Fixes #941

Changes

packages/core/src/utils/fetchRedirect.ts:

  • Added early return in shouldSkipRedirect when linkURL.host !== redirectURL.host
  • Cross-domain redirects now bypass the pathname comparison logic and are properly followed

Test plan

  • Added test for cross-domain redirect with same pathname
  • Added test for cross-domain redirect with different pathname
  • CI tests pass

🤖 Generated with Claude Code


Note

Low Risk
Low risk: small redirect-skip logic tweak plus targeted tests; main behavioral change is that cross-domain redirects will now be followed even when path/query match.

Overview
Fixes fetchRedirect incorrectly treating cross-domain redirects as “no-op” when the pathname/query match by updating shouldSkipRedirect to never skip redirects when host differs.

Adds MSW handlers and unit tests covering cross-domain redirects for both same-path and different-path cases, and includes a patch changeset for @headstartwp/core.

Written by Cursor Bugbot for commit 1e62299. This will update automatically on new commits. Configure here.

Add host comparison check in shouldSkipRedirect to ensure cross-domain
redirects are never skipped, even when pathnames match. This fixes an
issue where redirects configured from one domain to another with the
same pathname would result in 404 errors instead of proper redirects.

Fixes #941

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Feb 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
headstartwp-app-router Ready Ready Preview, Comment Feb 2, 2026 7:59pm
headstarwp Ready Ready Preview, Comment Feb 2, 2026 7:59pm

Request Review

@changeset-bot
Copy link

changeset-bot bot commented Feb 2, 2026

🦋 Changeset detected

Latest commit: 1e62299

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@headstartwp/core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

shouldSkipRedirect incorrectly skips cross-domain redirects when pathnames match

1 participant