Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR restores the functionality to store redirect URLs with domain node ID prefixes when content is under a root with an assigned domain. The fix addresses issue #20894 where redirects for content under domain-assigned roots were not being stored correctly, causing them to not function properly.
Key changes:
- Added
IDomainCachedependency toRedirectTrackerto check for domain assignments - Modified both
StoreOldRouteandCreateRedirectsmethods to prepend domain root ID to routes when applicable - Added test coverage for the domain prefix functionality
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/Umbraco.Infrastructure/Routing/RedirectTracker.cs |
Added IDomainCache dependency injection and logic to prepend domain root ID to routes in both storage and creation phases |
tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Routing/RedirectTrackerTests.cs |
Refactored existing tests and added new test Can_Store_Old_Route_With_Domain_Root_Prefix to verify domain prefix functionality |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Zeegaan
approved these changes
Nov 20, 2025
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.
Prerequisites
Fixes #20894
Description
As the linked issue describes, when we have a redirect created for a node under a root that has a domain assigned, we should be storing the integer ID of the node with the domain assigned as a prefix to the route. Looking back over the history, it seems this was lost in this update: #17491
In this PR I've restored it such that a redirect between
/page-1and/page-1aunder a root with a domain assigned will be stored as e.g.1058/page-1a.Testing
Set up as per the linked issue and create a redirect under one of the site roots.
With this update in place, you should see the domain listed correctly in the redirect tracker list.
From what I understand in the linked report, that should also lead to a functioning redirect:
And from testing I have verified that is the case. To do this locally, I've registered multiple local URLs via this addition in
Program.cs:You can then assign the
localhost:44339as one domain on a site root andlocalhost:44340on another and follow the reproduction steps on the linked issue.