Setup
CNAME
flattening occurs by default for all plans when your domain uses a CNAME
record for its zone apex (example.com
, meaning the record Name is set to @
).
For zones on paid plans, you can choose to flatten all CNAME
records. This option is useful for DNS-only (unproxied) CNAME
records. Proxied records are flattened by default as they return Cloudflare anycast IPs.
- Log in to the Cloudflare dashboard ↗ and select your account and domain.
- Go to DNS > Settings.
- Turn on the option CNAME flattening for all CNAME records.
Make a PATCH
request to the Update DNS Settings endpoint and set flatten_all_cnames
to true
in the request body.
Paid zones also have the option of flattening specific CNAME
records.
If you use this option, a special tag cf-flatten
will be added to the respective flattened CNAME
records in your zone file, allowing you to export and import records without losing this configuration.
- Log in to the Cloudflare dashboard ↗ and select your account and domain.
- In DNS > Settings, make sure that CNAME flattening for all CNAME records is turned off.
- Go to DNS > Records and find the
CNAME
record you would like to flatten. - Select Edit and turn on the Flatten option.
- Select Save to confirm.
With the available API endpoints, specify the following for each CNAME
record in the request body: