Is a wildcard CNAME DNS record valid?

Solution 1:

It is possible to do this. At one point it was up in the air a bit until 4592 clarified that it should be supported.

Just because it is possible doesn't mean it is supported by all DNS providers. For example, GoDaddy won't let you set up a wildcard in a CNAME record.

In terms of whether it is advisable or not to do this, it depends on your usage. Usually CNAMES are used for convenience when you are pointing to an "outside" domain name that you don't control the DNS on.

For example, let's say you set up a CMS system that allows you to have *.mycms.com as the site name (it uses host headers). You want customers to be able to easily set up *.cms.customer.com, without worrying that you might change your IP address at some point. In that case, you could advise them to set up a wildcard CNAME called *.cms.customer.com to www.mycms.com.

Because wildcard CNAMES aren't supported by all providers (such as GoDaddy), I wouldn't advise using it in a case where you suggested it for various customers (where you don't know their provider's capabilities).

Solution 2:

I added the line

*.www        IN CNAME        my_webserver

to my zone file in my bind config and that worked perfectly (ie. whatever.www.domain.com and whatever2.www.domain.com all pointed to my_webserver.

It was also possible to to add exceptions to this by adding the line

exception.www        IN CNAME        another_server

so that exception.www.domain.com pointed to another_server.


Solution 3:

Just to add that Amazon Route 53 supports wildcards in any record type.

So you can safely use Route 53 as your DNS provider.


Solution 4:

As far as I remember you can(ish) sort of do this, but then that CNAME can't be used by any other record type such as NS or MX.

Not quite sure what you're trying to achieve with the "wildcard" thing, so I'll have to give a generic answer :)

To clarify, CNAME aserver.domain means you can't have anothername.aserver.domain

There are exceptions, but I don't know what they are off the top of my head thou and not really sure what you want to do, so I shan't waste time.


Solution 5:

We use wildcard dns all the time, and we haven't had any issues. If you point it to an ipaddres, use:

*.mysite.com     Host (A)    Default     xxx.xxx.xxx.xxx

If you want to use an alias, do:

*.mysite.com.   IN CNAME mysite.com.