fix(core): keep same-domain filtering after an off-domain redirect - #3923
Merged
Conversation
When a request redirected to a different registrable domain, `resolveBaseUrlForEnqueueLinksFiltering` returned `undefined` for the `same-domain` strategy. With no base URL, no strategy patterns are built, and an empty pattern list means "no filtering" downstream - so instead of enqueueing nothing, every link on the page was enqueued, third party ones included. Falling back to the original request origin keeps the domain filter in place. Closes #3921
vladfrangu
approved these changes
Jul 29, 2026
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.
When a request redirects to a different registrable domain,
resolveBaseUrlForEnqueueLinksFilteringreturnedundefinedfor thesame-domainstrategy. The old comment claimed this makesenqueueLinksenqueue nothing, but the opposite happens: with no base URL the strategy patterns are never built, and an empty pattern list means "no filtering" downstream. The domain filter disappeared and every link on the page got enqueued, third party ones included — and from there the crawl kept expanding on the new domain.Falling back to the original request origin keeps the filter in place, which is also what the
same-hostnameandsame-originbranches already do.Closes #3921