How to serve first party cookies with Mautic - one instance, several domains

Yes it works, but you need to adjust the tracking code to the alias domain name. Which things didn’t work?

True, but this is a different approach with multi installations within one codebase. Different use case - I wanted to have an alias for the very same installation.

2 Likes

Hi Dirk, any chance you may be willing to create a Tutorial over your set up?

1 Like

We could include such a tutorial in the knowledgebase, happy to help!

2 Likes

Yes - why not. Will do… @rcheesley where is the knowledge base?

1 Like

kb.mautic.org but not launched yet. Please start a Google Doc and add to a card on this board!

1 Like

Hi,

I have set this up. The only difference is I am sharing my Cloudflare level SSL between my Mautic domain and CNAME Domains, a bit simpler then going into Let’s Encrypt and regenerating imo.

One caveat to this set up is the fact that the MainMauticInstall.com domain will always appear in your emails as the unsubscribe link even if using the CNAME Domain for Mautic sending and tracking. I think this can be a bit of a deliverability and congruency issue. I ended up spinning up the Mautic instances for each domain instead of going the CNAME Route.

Just my 2 cents on the system.

I appreciate the share.

1 Like

This Multiple Mautic plugin creates multiple Mautic installations using different table prefixes within a single database, but we wouldn’t recommend using it. One of our clients recently had to split their instances apart because the Multiple Mautic plugin was showing the 500 error for any additional instances installed through the plugin.

There’s no guarantee that this third-party plugin is compatible with later releases of Mautic.
Hosting multiple installations within the same database increases the likelihood that something could go wrong (i.e. database crash).

Splitting multiple instances apart was a fairly labor intensive job as we had to dump the DB, drop the tables belonging to other instances, then finally copy the assets, config, media, and themes directories from the non-standard folders that this plugin creates.

Since Mautic is open source and has no license fee for each instance, why not use a container-based solution such as LXC/LXD or Docker to deploy multiple instances of Mautic - one for each domain. That is something we, and our clients have had great success with.

2 Likes

Did you setup the server, too?

I have this situation:

  1. mautic.domain1.com
  2. mautic.domain2.com

The server that serves mautic.domain1.com, serves also other websites and is setup to redirect to a maindomain.com if a website is not found for the given host.

The server is an Apache one.

I’ve followed those steps to configure the aliases:

  1. Set a CNAME record in my DNS: mautic.domain2.com points to mautic.domain1.com

But when I try to go to mautic.domain2.com, I’m redirected to maindomain.com.

In fact, as the server that serves my Mautic instance cannot find any host that corresponds to mautic.domain2.com, simply redirects the browser to maindomain.com, that is the default host configured in Apache.

So, I think I have to add an alias for the host mautic.domain1.com set as mautic.domain2.com.

This way the serve will recognize the alias and will serve Mautic both from mautic.domain1.com and mautic.domain2.com.

At least I think, I’m going to try…

I’m having troubles trying to configure this setup.

I’ve opened a question on ServerFault: whoever is able to help, please, does so.

Ping @dirk_s

1 Like

Finally I solved it!

After many hours of tests and digging in the server, I discovered it was an issue with the Let’s Encrypt digital certificate: after a new challenge and a new verification of the third level domain, now all works as expected! :muscle:

2 Likes

This question did pop up for me recently and I was just about to write up a post asking if this is an issue the devs have anticipated. I’ve read what docs I can and I think I understand the basic ins & outs.

Can I ask if I’m good to go with how my setup is?

My main site is https://torontoheadshot.com and my Mautic install is https://marketing.torontoheadshot.com. Each have separate SSL certs as on my hosting they are considered separate web applications.

Being that I am using a subdomain of my tracked site I think I should be safe with this setup, yes?

I just set this up, however it doesn’t seem to be working for me…

I set up Mautic on ma.domai-a.com. Domain-a.com and ma.domain-b.com are both SANs on the same certificate. Both URLs point directly to my Mautic instance, and I changed the tracking code from ma.domain-a.com to ma.domain-b.com.

However. when I visit domain-b.com (the Wordpress site where I have placed the tracking code), the console still gives me the same-site error message, and indicates that it’s still pointing to ma.domain-a.com

Any ideas what I am doing wrong?

Yes, you are safe with your setup.

Until the second level domain is the same, there are no issues.

Which is the error? If you don’t post it we cannot know which the problem could be.

Are you sure dns are correctly propagated? Did you created a correct ssl certificate for ma.domain-b.com? Can you access Mautic going to ma.domain-b.com?

Mautic is installed at messaging.allthingscoos.com.

The wordpress site in question is https://coosguide.com. NOTE: the tracking script is only located on the homepage for testing purposes, it’s not in the header at the moment.

The CNAME is set up to point messaging.coosguide.com to messaging.allthingscoos.com

I can access my Mautic install at messaging.coosguide.com, so the DNS seems to be fine.

I verified that messaging.coosguide.com and messaging.allthingscoos.com are both SANs in the certificate.

From the Google Chrome console

A cookie associated with a cross-site resource at https://messaging.allthingscoos.com/ was set without the SameSiteattribute. A future release of Chrome will only deliver cookies with cross-site requests if they are set withSameSite=NoneandSecure. You can review cookies in developer tools under Application>Storage>Cookies and see more details at https://www.chromestatus.com/feature/5088147346030592 and https://www.chromestatus.com/feature/5633521622188032.

If I edit the URL Field under Settings > URL to "messaging.coosguide.com, then the issue goes away (but of course it would break it on the other site).

Which version of Mautic are you running?

Current Mautic version is 2.16.3

The only thing I can come up with is somewhere messaging.allthingscoos.com (the actual domain of the mautic install) should be rewritten to messaging.coosguide.com (the cname).

Does this KB exist yet? Would love to read it!

Has this feature been recommended for integration in Mautic core? If not, is there a way to request features? We are migrating from SharpSpring and this is standard feature now over there as well as on all the MAPS we have used – Marketo and Hubspot. Considering the wide use of microsites and product specific domains for modern content marketing, this seems like it should be standard part of Mautic too.

Hi,
Check this post:

2 Likes