Skip to main content
CNAME flattening
Dave Safley avatar
Written by Dave Safley
Updated over a year ago

CNAME flattening

CNAME flattening speeds up CNAME resolution and allows you to use a CNAME record at your root/apex domain (example.com).

This functionality is also what allows you to use a root custom domain with a Cloudflare Pages site.

​​How it works

With CNAME flattening, Cloudflare finds the IP address that a CNAME points to. This process could involve a single lookup or multiple (if your CNAME points to another CNAME). Cloudflare then returns the final IP address instead of a CNAME record, helping DNS queries resolve up to 30% faster.

For more details on the mechanics of CNAME flattening, review the CNAME flattening diagram and refer to the Cloudflare blog postOpen external link.

​​Aspects to keep in mind

  • CNAME flattening happens by default in some cases, as explained in its Setup page

  • If a CNAME target is being used to verify a domain for a third-party service, enabling the Flatten all CNAMEs setting may cause that functionality to work incorrectly since the CNAME record itself will not be returned directly.

Edit on GitHubOpen external link · Updated 2 months ago

Did this answer your question?