Does the * in a CNAME record take priority over explicit subdomains?
Asked Answered
M

2

28

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.

Middaugh answered 7/2, 2013 at 17:41 Comment(0)
S
52

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 CNAMEs:

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.
Spikes answered 7/2, 2013 at 18:6 Comment(1)
Well, yeah. RFC references are argument-enders of SO.Middaugh
C
8

No it does not, defined subdomains should take priority over a wildcard.

Culliton answered 7/2, 2013 at 17:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.