CNAME on the bare domain: why it is not allowed and what to use instead

Domains & DNS·· 3 views· 4 min read

The short answer: a CNAME says “this name is really that other name”. The DNS standard forbids a CNAME on a name that has any other record. The bare domain (example.com, also called the root or apex) always has the SOA and NS records, and nearly always MX and some TXT records. So a CNAME there is impossible. Some panels refuse it; others accept it and quietly break e-mail and verifications.

What you want, and what to use

What you want What to use
Point the bare domain at a server with a fixed IP An A record (and AAAA, if the server has IPv6) with the address.
Point the bare domain at a service that only gives you a name (site builder, shop platform, load balancer) An ALIAS or ANAME type, if your DNS provider has one; Cloudflare’s CNAME flattening; or the CNAME on www and a redirect from the bare domain to www.
Point www at an outside service A CNAME on www. No problem here: www has no other records.
A CNAME and a TXT on the same subdomain Not allowed either, by the same rule. Put the TXT on another name, or swap the CNAME for an A record.
An MX or NS pointing at a name that is a CNAME Not allowed. MX and NS must point at a name with its own A or AAAA record.

Fixing it without breaking e-mail

1 Check what the service actually asks for. Many services that give you a name for www also publish IP addresses for the bare domain. If they do, use them in A records, as in pointing at another server: A record or CNAME.
2 If all you have is a name, look in your zone editor’s list of types for ALIAS or ANAME. It is not a CNAME: the DNS server itself looks up the target’s address and answers with an IP, so it lives happily next to MX and TXT records. Each provider implements it in its own way.
3 If the zone is on Cloudflare, you can create the CNAME at the root: Cloudflare answers with the target’s addresses instead of the CNAME (it calls this flattening). See what changes with Cloudflare.
4 If neither exists, put the CNAME on www and redirect the bare domain to www, on your hosting or in the service itself. www or no www helps you pick which one is the main address.
5 Check at the end that e-mail is still there: dig example.com A +short
dig example.com MX +short
dig example.com CNAME +short
The first should return an IP, the second your mail servers, and the third should come back empty. (example: example.com is a domain reserved for examples, and 192.0.2.10 and 2001:db8::10 are documentation addresses; replace them with yours.)
If the panel let you save a CNAME on the bare domain, do not keep it. With a CNAME at the root, resolvers may ignore that name’s MX and TXT records: mail stops arriving, SPF and verifications fail, and sometimes only for some senders, which makes the problem hard to find.
This is what www is for. It has no SOA, NS or MX, so it can be a CNAME freely. When an outside service only gives you a name, serving the site on www is nearly always the simplest path.

A service wants a CNAME on your bare domain and you are not sure what to enter? Tell us the domain and what the service asks for.

Open a support ticket

SEE ALSO

DNS records explained: A, CNAME, MX, TXT and TTL

Pointing a subdomain to another server or service: A record or CNAME

www or no www: which address to choose for your site

Cloudflare: what it is, what changes, and what stays the same

MX records in depth: priority, several mail servers and the mistakes that lose e-mail

Reading a whole DNS zone line by line: names, trailing dots, TTL and the @ sign

RECOMMENDED PRODUCT

Register your .ao domain

Secure your company name before someone else registers it. from $33.30/yr

Search a domain
Was this answer helpful? Your answer helps us improve this article.