GotchaDifficulty: Intermediate2 min

A CNAME at the Root of a Domain

Pointing example.com at a CDN with a CNAME breaks its mail and is refused by most providers.

A CNAME cannot be used at the root of a domain, the bare name such as example.com, because a CNAME must be the only record at its name, and the root always needs other records: the SOA record that describes the zone and the NS records that name its servers, plus usually MX for mail. Most DNS providers refuse to create it; one that allows it breaks everything else at that name.

Picture a team moving its site to a CDN, which asks them to point the site at shop.cdn.example.net. They add a CNAME for www.example.com without trouble, then try the same for example.com.

The symptom. The DNS provider rejects the record. Or, on a provider that accepts it, the site loads and email to addresses at example.com stops arriving.

The root of example.com with a CNAME, against the same zone with an alias record

CNAME at the rootforbidden by the DNS standard

example.com. CNAME shop.cdn.example.net. sits beside the SOA, NS and MX records. Resolvers asking for the MX follow the alias to the CDN's name and find no mail server there.

Alias or flattened recorda provider feature

The provider looks up shop.cdn.example.net itself and answers queries for example.com with plain A and AAAA records. The SOA, NS and MX records stay untouched.

Why it happens. The rule that a CNAME stands alone comes from how resolvers use it: an alias means every question about the name is really about the other name. At the root, that would redirect the questions about the zone's own servers and mail as well.

What it costs. Mail is the usual casualty, because MX lookups follow the alias, and mail failures are noticed late. Verification TXT records at the root vanish the same way.

What to do instead. Use the provider's alias feature, often called ALIAS, ANAME or CNAME flattening, which resolves the target and publishes ordinary address records at the root. These are features of the DNS provider, not record types in the DNS standard, so resolvers only ever see A and AAAA. Where no such feature exists, point www at the CDN with a CNAME and redirect example.com to www with an A record to a small redirect service.