CNAME In Subdomain Not Working

Operating system - Ubuntu Linux 22.04.4
Webmin version - 2.111
Usermin version - 2.010
Virtualmin version - 7.20.2

I have a domain setup and created a subdomain which I want to repoint to a separate site/app.

Whilst I have LE SSL setup for the domain and sub domain, the redirected site shows no SSL, even though it has it.

On contacting the 3rd party support, they responded:
“After the Cname mapping you have to buy a wildcard SSL for the subdomain and install it separately as the SSL of your domain will not work for the subdomains after the Cname mapping or else You can use Cloudflare to get free SSL”

Not wanting to use Cloudflare, I then set the subdomain up as a new account (removing details from the original top domain account). I set up the CNAME and now I go to the default account web page. I remove Apache and just go to a ‘Forbidden’ page (I would expect this without CNAME)!

I did set up a wildcard (don’t shout at me!!!).

So, in the original top domain, CNAME worked, but without SSL on redirect. On a separate account subdomain, it doesn’t work - what have I missed?

If you have a CNAME pointing to the subdomain?
When creating the LE SSL for the subdomain, enter the CNAME you have in your dns for it as well in the Domain names listed here box.

No need for wild card.

Example would be:
If I have a CNAME www.sub.domain.tld
I would enter that into the box along with sub.domain.tld

sub.domain.tld
www.sub.domain.tld

Why bother with CNAME at all isn’t this what you actually want?

Thanks for the response.

I want this:
subdomain.domain.tld cname anothersubdomain.anotherdomain.tld

Who is managing the dns here ? Virtualmin or your provider. Tbf I wouldn’t bother with a cname just create the a records in wherever your dns is managed

You would need to create a forward if you are going from one domain.tld to another.tld, CNAME only works within the domain.tld level and its subs. This is why your SSL is not working when using a CNAME as a forwarder.

VM is managing dns.

How would I do this? I thought CNAME did this?

I am using a whitelabel SAAS so pointing my subdomain to their subdomain to ensure my domain is always the visible one.

Try this,

Re-create the LE SSL for your domain.tld and add to the list sub.domain.tld
You do not need to create a subserver for this. Only need the entry from your DNS, in this case it is your CNAME that you created.

Your problem is when you created a sub account, it created an A record for that sub.
Remove the sub account and make sure the A record for that sub is removed from DNS

I initially did this and it does redirect, but it then shows that the connection is not SSL! As mentioned, the whitelabel developer states:
“After the Cname mapping you have to buy a wildcard SSL for the subdomain and install it separately as the SSL of your domain will not work for the subdomains after the Cname mapping…"

For the sake of good order, I have gone back to basics, deleted sub domain and just added to tld DNS. Fingers crossed.

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