Setup
import { Render, TabItem, Tabs, GlossaryTooltip, DashButton } from "~/components";
:::note
If the CNAME target is on the same zone as the CNAME record, Cloudflare proceeds with CNAME flattening and ignores the CNAME Flattening setting.
:::
For your zone apex
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 all CNAME records
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.
-
In the Cloudflare dashboard, go to the DNS Settings page.
-
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.
:::caution
:::Per record
Paid zones also have the option of flattening specific CNAME records.
If you use this option, a special tag cf-flatten-cname will be added to the respective flattened CNAME records in your zone file, allowing you to export and import records without losing this configuration.
- On the DNS Settings page, make sure that CNAME flattening for all CNAME records is turned off.
- Go to the DNS Records page and find the CNAME record you would like to flatten.
- Select Edit and turn on the Flatten option.
- Select Save to confirm.
- The record is at the zone apex.
- The record is already proxied, which means it will be flattened by default.
- CNAME flattening for all CNAME records is turned on, which means you cannot override it per record. :::
With the available API endpoints, specify the following for each CNAME record in the request body:
"settings": {
"flatten_cname": true
}
谢谢你的反馈!