Drupal Version
10.5.4
Domain module version
This is happening when I upgrade from beta6 to beta7.
Issue Described
I've since rolled back my version back to beta6 and all is working as expected.
The issue is I have two domains I'll refer to as domainA and domainB. When I go to domainA I see the correct front page and when I go to domainB on either test or live (on a pantheon site) I get redirected to domainA. This issue does not present itself locally or in any other environments like dev or a multidev instance. I also notice if I clear the cache and go straight to domainB, that homepage loads as expected and then I go to domainA it redirects me to domainB.
The front pages are setup using the `domain_config` module under Basic Site Settings `admin/config/system/site-information`.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 03-3555807-domain_source.patch | 863 bytes | protitude |
Issue fork domain-3555807
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
mably commentedCould you provide a full reproducible scenario from a fresh Drupal instance please?
I haven't been able to reproduce the problem locally.
Comment #3
protitude commentedSorry, but I can't get this to break anywhere but on pantheon test and live environments which leads me to the conclusion that it has something to do with their handling of caching. For a bit more background both of my front pages are basic pages with the source set, so they'll forward if pulled up on the wrong domain. Digging into the new "/domain/domain_source/src/HttpKernel/DomainSourceRouteProvider.php" I notice that the 'cid' does not distinguish between domains, which leads to the exact same cache ID for both of my sites on the front page:
route:[language]=en:[query_parameters]=:/I went ahead and added the domain to the cache ID and tested my issue and everything appears to be working correctly for me. There may be a better way to go about this, but I think it at least helps pinpoint where I'm having an issue. See my attached patch.
Comment #4
mably commentedHi @protitude, thanks a lot for your investigation!
Not sure that code has been changed between beta 6 and 7.
I'll have a look a it.
EDIT: The related code has possibly changed between beta6 and 7. Investigating.
Comment #5
mably commentedComment #6
mably commented@protitude wondering how the routes can be varying per host? An idea?
Locally I have two different
$cidfor my 2 domains home pages:route:[language]=en:[query_parameters]=:/node/1And
route:[language]=fr:[query_parameters]=:/node/12Are you using other modules to manage your home pages?
Comment #7
protitude commentedThanks for the quick response @mably!
That's interesting. I'm using the domain_config module and setting this through Basic Site Settings:
My 2 domains are as follow with my included patch:
route:[language]=en:[query_parameters]=:/:[domain]=oit.ddev.siteand
route:[language]=en:[query_parameters]=:/:[domain]=data.ddev.siteThe domain modules I currently have enabled are:
I think domain_theme_switch is the only one that's not included in the core domain module. I hope that's helpful.
Comment #8
mably commented@protitude can you give us the cached routes for those 2 cids?
Comment #9
protitude commentedHere's a dump of the $cached_value for each domain, let me know if I'm misunderstanding what you need.
data site:
OIT site:
Comment #11
mably commentedComment #12
mably commented@protitude could you give a try to this issue's MR please?
Comment #13
mably commentedComment #15
protitude commentedI took a patch of your changes and everything worked as expected on our test environment. Thanks so much for looking into this so quickly, I'll deploy the patched version of the module tomorrow to our live site.
Comment #16
mably commented@protitude thanks for testing.
If it fixes the problem on your live site, I'll merge it.
Comment #17
freezernick commented+1 RTBC
We encountered this issue too on a multidomain installation. This patch resolved the error for our install
Comment #18
protitude commented@mably, I just deployed to our live site and everything appears to be working as expected. This fixed it for me. Thanks again for the help.
Comment #21
mably commentedComment #23
mably commentedMerged.
Thanks a lot @protitude for helping fix this nasty bug!
Comment #24
junaidpvThank you! We were having this exact issue. I applied the change merged in the 2.0.x branch and it helped to fix the issue.
Comment #25
mably commentedThanks @junaidpv for your feedback.
I'll publish a beta8 release in the coming hours.