wildcard dns not working properly [duplicate]

I initially added a wildcard subdomain as below on my cpanel account and it works fine (all level of subdomain works):

  1. *.example.com

but when I add following second wildcard subdomain to explicitly install ssl for that:

  1. *.co.uk.example.com

any domain ending with .uk.example.com no longer work (e.g. uk.example.com or test.net.uk.example.com ... etc)

is there anything wrong with dns server bind or is this by design?


It sounds like everything is working as intended and that the confusion here stems from not knowing how DNS wildcards are supposed to work.

The wildcard matches any names below the point of wildcard record which are in branches that do not exist (keep in mind, DNS is a tree).

When you added the new *.co.uk.example.com record (doesn't particularly matter that this new record was a wildcard too, any record would have caused the same kind of effect, eg if you had added foo.co.uk.example.com) this means that uk.example.com now is part of an existing branch and now your old *.example.com record no longer applies to anything that ends in uk.example.com.

If you really want to use wildcards (usually better to avoid this, but you don't explain your use case), you will likely want to add specific records for all of uk.example.com, *.uk.example.com, co.uk.example.com to restore some kind of similar functionality as you had before.