How to set up mirrored subdomains

When I add the domain to CF, it works, but none of the mirrored subdomains resolve. I’ve tried adding them as CNAME entries, as A records and none of these options work. Anyone know how to make this kind of set up work?

For reference, this is an old website built on Drupal 7 using Domain Access for 23 subdomains that are mirrored to the main domain.

Thanks.

What is a mirrored sub-domain (or host, as that is what you’ll refer to)?

What’s the domain and which hostnames are you referring to?

Hi Sandro.

A mirrored subdomain does what it sounds like. If someone types in the subdomain they actually go straight to the main domain. While this seems redundant, it is how Drupal 7 enables setting up multiple sites via subdomains on one install of Drupal. Drupal recreates the subdomain url to display the unique content for that subdomain.

The main domain, domain.com works fine when added to Cloudflare, but none of the subdomains are. Tried added the subdomains as a CNAME and as an A record to the IP address. Tried Proxied and DNS only. None worked.

I am still not sure what you mean but that’s not a “mirrored host” but simply a redirect.

That domain is not using Cloudflare in the first place.

nslookup -type=ns domain.com k.gtld-servers.net
Server:  UnKnown
Address:  192.52.178.30

domain.com      nameserver = ns-166.awsdns-20.com
domain.com      nameserver = ns-683.awsdns-21.net
domain.com      nameserver = ns-1250.awsdns-28.org
domain.com      nameserver = ns-2022.awsdns-60.co.uk

domain.com is not the actual domain name. I just used that as an example.

Well, an example is obviously useless.

I can’t add it to Cloudflare without breaking the site. I’ve needed to remove it in order to get it work again. I’m just looking for some help with configuration to make this work with Cloudflare.

So the whole domain is not on Cloudflare right now?

There is not much to configure. Cloudflare will proxy whatever it receives from the server. What you can do on Cloudflare is redirects and that’s achieved via page rules. Everything else needs to be configured on your server.

It’s easy, make sure your site works fine on its own (also on HTTPS) and only then add it to Cloudflare.

The website does work fine on its own and has been working fine for about 8 years now. Adding to Cloudflare works fine for the main domain but none of the mirrored subdomains work. I’m starting to repeat myself here.

I tried adding each subdomain as a CNAME pointing to the main domain. Doesn’t work. Tried adding the subdomain as an A record pointing the server IP, doesn’t work. Tried making the subdomains proxied and DNS only. Doesn’t work.

So far it isn’t easy as you say.

It still is not clear what you mean by mirrored.

And yes, it is that easy. Cloudflare will proxy exactly what it receives and that’s it.

For the third time, what’s the domain and what records are you referring to?

1 Like

I have changed over to Cloudflare. You can see that albertacf.com is working. But subdomains are not. You can try central.albertacf.com, entre-corp.albertacf.com for examples.

I have added in A records pointing to the server IP.

Central and Entre-corp are not proxied by Cloudflare, though they both work, but do not have TLS/SSL certificates on them. You need to get them working with HTTPS before you proxy them with Cloudflare.

They work? I’m not seeing that at my end.

Unfortunately, it is not possible to add and SSL certificate to this site. When it was built, maybe 8 years ago, SSL certificates were optional. Because of the need to mirror the subdomains to the main domain, an SSL certificate can’t be added to this setup. The site is coming to end of life at the end of 2021 as that is when Drupal 7 will stop being supported but in the meantime, just trying to get this working to cut down on all the bots, etc. hitting the site.

That domain is on Cloudflare and the two hosts are proxied. What is not working at this point?

But, if you do not have SSL on your server we don’t even need to continue as that setup won’t fly anyhow. You need to fix that first.

I rebooted my computer and the subdomains are coming up. They weren’t before. So in my mind this can work. The SSL certificate is definitely an issue but the client doesn’t want to do what it takes to rebuild the site so all I can do is limp along like this.

Thanks for your help.

Just make sure your client understands that his whole site is still on HTTP and every request is transmitted in plain text.

Yes. This has been an ongoing discussion and I’ve tried to make them very aware. I can only let go and at least feel a bit better that it is now working behind Cloudflare.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.