Skip to content

fix: shouldSkipRedirect incorrectly skips cross-domain redirects#942

Merged
nicholasio merged 2 commits intodevelopfrom
fix/cross-domain-redirect-skip
Feb 13, 2026
Merged

fix: shouldSkipRedirect incorrectly skips cross-domain redirects#942
nicholasio merged 2 commits intodevelopfrom
fix/cross-domain-redirect-skip

Conversation

@devinle
Copy link
Contributor

@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
Small, well-scoped change to redirect-skipping logic with added test coverage; limited to redirect resolution behavior.

Overview
Fixes fetchRedirect incorrectly treating cross-domain redirects as skippable when the pathname/query matches, by adding a host comparison so cross-domain redirects are always followed.

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

Written by Cursor Bugbot for commit 4b05c4d. 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 13, 2026 1:15am
headstarwp Ready Ready Preview, Comment Feb 13, 2026 1:15am

Request Review

@changeset-bot
Copy link

changeset-bot bot commented Feb 2, 2026

🦋 Changeset detected

Latest commit: 4b05c4d

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

@github-actions
Copy link
Contributor

📦 Next.js Bundle Analysis for @10up/wp-nextjs-app

This analysis was generated by the Next.js Bundle Analysis action. 🤖

🎉 Global Bundle Size Decreased

Page Size (compressed)
global 83.62 KB (🟢 -42.45 KB)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

@github-actions
Copy link
Contributor

📦 Next.js Bundle Analysis for @10up/headstartwp

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@nicholasio nicholasio merged commit 03cf6a6 into develop Feb 13, 2026
21 checks passed
@nicholasio nicholasio deleted the fix/cross-domain-redirect-skip branch February 13, 2026 01:39
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

2 participants

Comments