Does the * in a CNAME record take priority over explicit subdomains?
13,268
Solution 1
Wildcards will only match records that aren't otherwise defined in the zone.
See RFC 1912, it mentions MX
records here but the same applies to CNAME
s:
2.7 Wildcard records
Wildcard MXs are useful mostly for non IP-connected sites. A common
mistake is thinking that a wildcard MX for a zone will apply to all
hosts in the zone. A wildcard MX will apply only to names in the
zone which aren't listed in the DNS at all. e.g.,
podunk.xx. IN NS ns1
IN NS ns2
mary IN A 1.2.3.4
*.podunk.xx. IN MX 5 sue
Mail for mary.podunk.xx will be sent to itself for delivery. Only
mail for jane.podunk.xx or any hosts you don't see above will be sent
to the MX. For most Internet sites, wildcard MX records are not
useful. You need to put explicit MX records on every host.
Solution 2
No it does not, defined subdomains should take priority over a wildcard.
Related videos on Youtube
Author by
Sudhir Jonathan
I like big keyboards and I cannot lie. https://sudhir.io
Updated on February 08, 2020Comments
-
Sudhir Jonathan over 4 years
I have a set of subdomains defined on my domain like this:
CNAME sub1.example.com -> sub1.herokuapp.com CNAME sub2.example.com -> sub2.appspot.com CNAME www.example.com -> example.herokuapp.com
Now I'd like to add
CNAME *.example.com -> example.herokuapp.com
to catch folks who put in too many WWWs or type in other missing subdomains. But will the*
take priority over the explicitly defined subdomains or will the subdomains continue to work as expected?I'm using Route53 if it makes a difference.
-
Sudhir Jonathan over 11 yearsWell, yeah. RFC references are argument-enders of SO.