Drupal Version
- 10.5.3
PHP: 8.3
Domain module version
- 2.0.0-beta4
Expected Behavior
Prior to this module update, we had two domains on the site, which shared content for component display between domains. However when you clicked on the card to go to the page the component was displaying, it would bring you to the domain that was set as the domain source selection.
All of these pages have "send to all affiliates" checked so that both domains have access to use the pages, but the url always respected the Domain Source setting and directed the page itself to the main url.
This has worked this way since we set up the Domain configuration for over a year.
Expected Behavior Example:
- I'm on domain-a.
- I click on a card for a page that links to content on domain-b.
- It loads the content using domain-b url, as this is the domain set as Domain Source.
- If you were to go directly to that url with domain-a in the url link, Domain would automatically redirect you to the correct path of domain-b since the "Send to all affiliates" and Domain Source setting are both set for that content.
Actual Behavior
Now, no pages that are set to use more than one domain or set to send to all affiliates respect the Domain Source for a main redirection to the correct domain url.
Now we get two urls when the links are clicked, it just uses whatever the domain you are on prior and doesn't redirect to the Domain Source selection like it did prior.
Actual Behavior Example:
- I'm on domain-a.
- I click on a card for a page that links to content on domain-b.
- It loads the content using domain-a url, ignores the domain-b being set as Domain Source and gives us a url, that is considered duplicate content of the correct source domain.
- If you were to go directly to that url with domain-a in the url link, Domain keeps the url as the incorrect url for domain-a/path-to-page even though the "Send to all affiliates" and Domain Source setting are both set for that content and it should be redirecting to the source domain url.
Steps to reproduce
- Create two domains
- Create a node
- Set the node to "Send to All Affliates"
- Set the Domain Source to one of the domains specifically.
- Save.
- manually go to the url of that page using the domain you DID NOT set as the domain source.
- Expected behavior would be, it would redirect and change the domain to the source domain.
- Actual behavior is, it will just load that page url with the domain that is not the source domain and do no redirection a t all.
Reverting the module back to 2.0.0-beta3 immediately fixed the issue.
I'm also not sure that Domain Source is being respected for the Sitemap.xml setting in the Domain module either, but that would be it's own ticket and I would need to test more, this is however an immediate problem.
Issue fork domain-3548531
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
rkelbel48 commentedComment #3
rkelbel48 commentedComment #4
mably commentedAre you using any third-party domain module?
Can you list all the domain-related modules that are enabled on your site?
Could you give us a reproducible scenario from a fresh Drupal instance?
Comment #5
rkelbel48 commentedThe only module we have on that is not a Domain submodule is "Domain Access Simple Sitemap".
Comment #6
mably commentedSome domain-related custom code may be?
Comment #7
rkelbel48 commentedThird Party:
Comment #8
mably commentedDomain Unique Path Alias is also a third party module.
Comment #9
rkelbel48 commentedDomain Unique Path Alias is also a third party module.Ok... it comes up under the Domain list in the enabled modules list so I didn't know that.
Either way we had all of these same module with the prior beta release and had literally zero issues with this functionality.
I've looked for custom code and I have not located anything that would interfere with the Domain Source redirection of the url, which is a setting in the Domain module itself and is currently switched on.
Comment #10
mably commentedJust started a fresh Drupal 10.5.3 instance with Domain 2.0.0-beta3.
I’m not seeing the redirect behavior you’re describing.
As far as I know, that isn’t a standard feature of the Domain Source module.
Could you try to reproduce your problem on a fresh Drupal 10 instance please?
Otherwise, I won’t be able to help you much.
Comment #11
mably commentedComment #12
rkelbel48 commentedWhy don't you tell me what it did do, if it didn't work as I described?
It will do nothing or 403 if the send to all affiliates are not also turned on for the node.
Comment #13
cindytwilliams commentedI'm having this issue as well. I will try to post some reproducible steps.
Comment #14
mably commentedIt would be really helpful to have a reproducible scenario on a fresh Drupal installation that works with beta3 but fails with beta4.
Comment #15
mably commentedComment #16
nebel54I experienced a similar issue. Menu links pointing to external domains were not re-written anymore after the upgrade from Drupal 10.4.6 to 11.2.5 and Domain 2.0.0beta2 to beta4 and 5. Links set via the link field in nodes were still correctly re-written to link to external domains.
I was not able to restore functionality through downgrading to beta2 and found out that in the DomainSourcePathProcessor.php of domain_source the function DomainSourceRouteMatcher::routeMatch($path) did not return a valid route info.
Instead of digging further I tried to apply the core patch from https://www.drupal.org/project/drupal/issues/3202329#comment-16226547 which makes the path processor bypass the DomainSourceRouteMatcher::routeMatch function and that solved the issue for me.
Comment #17
mably commentedHi @nebel54, could you give us a bit more details about this:
Comment #18
nebel54Sorry, I am not able to investigate the issue further at the moment (I might have time in the evening). But the method returned NULL instead of the route info.
Comment #19
nebel54I got too curious and did a few more tests:
Steps to recreate:
Drupal: 11.2.5
Domain: 2.0.0-beta5
Only domain and domain_source modules are activated, minimum setup with two subdomains
- Create a node on domain2 without path alias
- Add the node to a menu (/node/2)
- Menu link has correct domain2 link
- Add a path alias (/my-path) to the node
- Url in Menu still shows correct link, as the menu has still the plain node url stored (/node/2)
- Edit menu again use /my-path as link
- Expected: Link should point to domain2, instead points to /my-path on default domain, when opening /my-path the node is also not redirected to domain2
In DomainSourceRouteMatcher::doMatchCollection() the matcher tries to match /my-path to the regex "{^/node/(?P|d+)$}sDuu", which then returns NULL.
Comment #20
mably commented@nebel54 could you give a try to change the outbound path processor priority like this (90 -> 400) :
Seems to fix the problem on my side.
Will create an MR to see if it generates any side effects.
Comment #22
mably commentedOk, looks like we might break this: #2973694: Outbound path processor does not have access to language and then redirects.
Let’s try a different approach.
Comment #23
nebel54Good catch! Yes - it would fix this issue though :) I checked on the small test setup & the site that I originally encountered this issue on.
Comment #24
cindytwilliams commentedThe MR also fixes this issue for me.
Comment #26
mably commented@nebel54 @cindytwilliams
I worked on another fix (MR 242) that preserves compatibility with translated contents.
Could you give it a try and give me an RTBC if it works for you? Thanks.
Comment #27
mably commentedI have added a series of path alias functional tests so we don't get hit again by this problem in the future.
Comment #29
cindytwilliams commentedThe latest MR changes are working for me.
Comment #30
nebel54Works for me as well! That is an impressive amount of tests you have added @mably! Thank you!
Let's still hope that #3202329: Outbound path processors miss the route name and parameters lands in core soon!
Comment #31
mably commentedThat would definitely bring a significant performance improvement when using the domain source path processor.
Let's merge this for now.
Comment #35
mably commentedComment #37
4kant commentedHi,
I´m on drupal 10.5.3 and domain 2.0.dev.
I have a menu where 3 domains each have a block with their links (= each domain has its front page on menu level 0 and the corresponding subpages are linked below it, in level 1).
Each node is assigned to one of the three domains via the_domain_source field.
The links in the menu are created normally (using the node ID rather than as an absolute link) and have always correctly led/redirected to the respective domain.
After updating today (including the database update) to the new .dev version from October 7, 2025, the redirects no longer work.
I had to revert to the "old" .dev version.
Comment #38
4kant commentedComment #39
mably commentedHi @4kant, it looks like we have found another edge case that is not covered by our functional tests.
I added in latest dev a new functional test to ensure that menu links referencing content with a defined domain source field are handled correctly.
Can you give a full reproducible scenario on a fresh Drupal 11 install please?
BTW what do you call the "old" dev version?
Comment #40
4kant commentedHi @mably,
thanks for your quick reply.
The "old" dev version: I can´t find a version number in any of the .info-files. It always says: " version: VERSION".
But the date of the info files is April 28th.
Don´t know if or when i can give you a full reproducible scenario on a fresh Drupal 11 install. I do my best.
Thanks!
Comment #41
mably commentedIf no reproducible scenario is provided, I’ll close this issue in 3 months.
Comment #42
4kant commentedI've now installed a clean Drupal 11 installation with domain 2.0.0-beta6 and configured it according to my existing Drupal instance.
Everything worked correctly in Drupal 11. All menu items linked to the correct domain.
I then repeated the process with my Drupal instance (10.5.3).
Unfortunately, the menu links aren't interpreted correctly there – as described above.
Comment #43
4kant commentedI will do another install with a clean drupal 10 installation and get back here soon.
Comment #44
mably commentedPostponing until we get new elements allowing to work on it.
Menu links are displaying fine on my 10.5.3 instance. So I cannot reproduce the problem for now.
Comment #45
4kant commentedWhatever has happened in the meantime:
The current dev version no longer has this bug. Everything is running perfectly.
Thanks!
Comment #47
mably commented@4kant Thanks for confirming that the issue has been resolved.
Comment #48
cindytwilliams commented@mably can this change released in domain version 2.0.0 as well?
Comment #49
mably commented@cindytwilliams it's already been merged on the 2.0.x dev branch.
I plan to make a new beta release at the end of the month.
Comment #50
cindytwilliams commentedAh, thank you!