CNAME Flattening: Why Your Root Domain Needs It
If you have ever tried to point your root domain (example.com, not www.example.com) to a hostname like a CDN endpoint, load balancer, or hosting platform, you have run into this problem.
The DNS specification does not allow CNAME records at the zone apex. So how do services like Cloudflare, Route 53, and NS1 let you do it anyway?
Why CNAME at Root Is Forbidden
A CNAME record says "this name is an alias for another name." DNS resolvers follow the alias chain to find the final A record (IP address).
At the zone apex, you must have an SOA record and NS records. The DNS spec says a CNAME at the zone apex conflicts with these mandatory records — a zone apex cannot be both a CNAME alias and a zone with NS records. Technically, it creates an inconsistency that some resolvers handle incorrectly.
This means you cannot write:
example.com. IN CNAME myapp.cdn-provider.com.
It violates RFC 1034. Many DNS providers will simply refuse to save it.
The Problem This Creates
Modern hosting and CDN platforms typically give you a hostname to point your domain to, not an IP address. Vercel gives you cname.vercel-dns.com. Netlify gives you apex-loadbalancer.netlify.com. Fastly, Cloudflare, AWS CloudFront, and most other platforms do the same.
These providers use dynamic IPs that change. They want you to point to a hostname so they can update the IPs behind it without breaking your configuration. A hardcoded A record pointing to one IP does not handle their IP changes.
For subdomains (www.example.com), this is fine — you use a CNAME. For the root domain, you are stuck.
CNAME Flattening: The Solution
CNAME flattening (also called ALIAS records, ANAME records, or synthetic flat CNAME records) is a DNS provider extension. It is not a DNS spec feature — it is implemented inside the DNS provider's authoritative nameserver.
When you configure a CNAME-flattened record at the zone apex:
- The DNS provider's nameserver receives a query for example.com
- The nameserver internally resolves the CNAME chain (follows example.com's CNAME alias to the final hostname)
- The nameserver returns the resolved A record (IP address) directly to the requester
- From the requester's perspective, they queried example.com and got an A record back — no CNAME in the response
The CNAME resolution happens inside the authoritative nameserver, invisible to the requester. This keeps the DNS response technically compliant while giving you the dynamic-IP flexibility of a CNAME.
How to Configure It
Cloudflare: Add a CNAME record for the root domain (@). Cloudflare automatically flattens it. No special setting needed. Cloudflare calls this "CNAME flattening."
Route 53: Use an Alias record. When creating a record set for the zone apex, select "Alias" and point it to the AWS resource (CloudFront distribution, load balancer endpoint). Route 53's Alias records resolve at the edge and return A records to requesters.
Netlify, Vercel, Render, and most modern hosting platforms: Their nameservers support CNAME flattening natively. If you use their DNS, the apex CNAME configuration works out of the box.
When This Matters
You need CNAME flattening any time you want your root domain (not www) to point to a CDN, hosting platform, or load balancer hostname. This is the default setup for:
- Jamstack sites on Netlify, Vercel, or Cloudflare Pages
- Sites behind Cloudflare CDN
- AWS applications behind CloudFront
- Any service that gives you a hostname endpoint rather than a static IP
If your hosting provider gives you a static IP, you can use a regular A record at the root. But static IPs are increasingly rare in cloud-hosted infrastructure.
Using a DNS provider that supports CNAME flattening (Cloudflare does it for free) is the standard approach for any modern site setup.