CNAME Flattening Explained

The zone apex cannot hold a CNAME, but modern hosts want you to point the apex at a hostname. Flattening resolves that contradiction: the provider quietly resolves the target and answers with plain A records. You keep CNAME ergonomics; the internet sees legal DNS.

How it works

You enter a CNAME at the root, something RFC rules technically forbid. Your DNS host, at query time or publish time, resolves that target itself and returns the resulting IP addresses as if they were ordinary A records. Cloudflare does this automatically for any apex CNAME; Route 53 and DNSimple expose it as ALIAS records; some hosts offer both modes.

On-query vs on-publish

Flatten on queryFlatten on publish
FreshnessAlways currentCurrent as of last refresh + TTL
SpeedSlightly slower (resolution at edge)Fastest
Failure modeDepends on provider resolversStale IPs after target changes

When to use it

  • Pointing the apex at CDNs, load balancers, and PaaS hosts that give you a hostname, not an IP.
  • Escaping origin IPs that rotate without notice.
  • Anywhere you would use a CNAME if the name weren't the root.

The caveats

  • It is a provider feature, not portable DNS: moving your zone elsewhere means re-creating the setup there.
  • Only address records flatten; TXT verification living at the target does not transfer to your apex.
  • Keep TTLs modest (300) so answers track a moving target.

Verify yours

An A-record lookup on your apex returns the flattened addresses; a CNAME record lookup shows whether your provider exposes the underlying alias.

Last verified: 2026-12-02