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.
A CNAME will take precedence over all other DNS records. This means that when a CNAME is present, all other DNS records are ignored. This includes NS records, A records, MX records, etc.
A wildcard DNS record is a record that answers DNS requests for any subdomain you haven't already defined. You can create wildcard A records and CNAME records by entering an asterisk (*) in the Host field when creating a DNS record. For example, if you create the wildcard A record *.
A Canonical Name or CNAME record is a type of DNS record that maps an alias name to a true or canonical domain name. CNAME records are typically used to map a subdomain such as www or mail to the domain hosting that subdomain's content.
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.
No it does not, defined subdomains should take priority over a wildcard.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With