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

Command icon 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

rkelbel48 created an issue. See original summary.

rkelbel48’s picture

Issue summary: View changes
rkelbel48’s picture

Issue summary: View changes
mably’s picture

Are 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?

rkelbel48’s picture

Are you using any third-party domain module?

The only module we have on that is not a Domain submodule is "Domain Access Simple Sitemap".

mably’s picture

Some domain-related custom code may be?

rkelbel48’s picture

Can you list all the domain-related modules that are enabled on your site?

  • Domain
  • Domain Access
  • Domain Alias
  • Domain Configuration
  • Domain Configuration UI
  • Domain Content
  • Domain Source
  • Domain Unique Path Alias

Third Party:

  • Domain Access Simple Sitemap
mably’s picture

Domain Unique Path Alias is also a third party module.

rkelbel48’s picture

Domain 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.

mably’s picture

Just 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.

mably’s picture

Status: Active » Postponed (maintainer needs more info)
Issue tags: +Needs steps to reproduce
rkelbel48’s picture

Why 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.

cindytwilliams’s picture

I'm having this issue as well. I will try to post some reproducible steps.

mably’s picture

It would be really helpful to have a reproducible scenario on a fresh Drupal installation that works with beta3 but fails with beta4.

mably’s picture

Priority: Critical » Normal
nebel54’s picture

I 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.

mably’s picture

Hi @nebel54, could you give us a bit more details about this:

I (...) found out that in the DomainSourcePathProcessor.php of domain_source the function DomainSourceRouteMatcher::routeMatch($path) did not return a valid route info.

nebel54’s picture

Sorry, 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.

nebel54’s picture

I 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.

mably’s picture

@nebel54 could you give a try to change the outbound path processor priority like this (90 -> 400) :

  domain_source.path_processor:
    class: Drupal\domain_source\HttpKernel\DomainSourcePathProcessor
    arguments:
      [
        '@domain.negotiator',
        '@module_handler',
        '@entity_type.manager',
        '@config.factory',
        '@path.matcher',
      ]
    tags:
      - { name: path_processor_outbound, priority: 400 }

Seems to fix the problem on my side.

Will create an MR to see if it generates any side effects.

mably’s picture

Ok, 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.

nebel54’s picture

Good catch! Yes - it would fix this issue though :) I checked on the small test setup & the site that I originally encountered this issue on.

cindytwilliams’s picture

The MR also fixes this issue for me.

mably’s picture

@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.

mably’s picture

Version: 2.0.0-beta4 » 3.x-dev
Status: Postponed (maintainer needs more info) » Needs review
Issue tags: -Needs steps to reproduce

I have added a series of path alias functional tests so we don't get hit again by this problem in the future.

mably changed the visibility of the branch 3548531-domain-no-longer to hidden.

cindytwilliams’s picture

Status: Needs review » Reviewed & tested by the community

The latest MR changes are working for me.

nebel54’s picture

Works 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!

mably’s picture

Let's still hope that #3202329: Outbound path processors miss the route name and parameters lands in core soon!

That would definitely bring a significant performance improvement when using the domain source path processor.

Let's merge this for now.

  • mably committed 64106b43 on 3.x
    Issue #3548531 by mably, nebel54: Domain no longer respects Domain...

  • mably committed 11f93417 on 2.0.x
    Issue #3548531 by mably, nebel54: Domain no longer respects Domain...
mably’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

4kant’s picture

Hi,
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.

4kant’s picture

Status: Fixed » Active
mably’s picture

Hi @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?

4kant’s picture

Hi @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!

mably’s picture

Status: Active » Postponed (maintainer needs more info)

If no reproducible scenario is provided, I’ll close this issue in 3 months.

4kant’s picture

Status: Postponed (maintainer needs more info) » Needs work

I'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.

4kant’s picture

I will do another install with a clean drupal 10 installation and get back here soon.

mably’s picture

Status: Needs work » Postponed (maintainer needs more info)

Postponing 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.

4kant’s picture

Status: Postponed (maintainer needs more info) » Fixed

Whatever has happened in the meantime:
The current dev version no longer has this bug. Everything is running perfectly.
Thanks!

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

mably’s picture

@4kant Thanks for confirming that the issue has been resolved.

cindytwilliams’s picture

@mably can this change released in domain version 2.0.0 as well?

mably’s picture

@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.

cindytwilliams’s picture

Ah, thank you!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.