Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/content/docs/dns/cname-flattening/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ This functionality is also what allows you to use a [root custom domain](/pages/

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](/dns/cname-flattening/cname-flattening-diagram/) and refer to the [Cloudflare blog post](https://blog.cloudflare.com/introducing-cname-flattening-rfc-compliant-cnames-at-a-domains-root/).
For more details on the steps involved in `CNAME` flattening, review the [CNAME flattening diagram](/dns/cname-flattening/cname-flattening-diagram/) and refer to the [Cloudflare blog post](https://blog.cloudflare.com/introducing-cname-flattening-rfc-compliant-cnames-at-a-domains-root/).

## Aspects to keep in mind

* `CNAME` flattening happens by default in some cases, as explained in its [Setup page](/dns/cname-flattening/set-up-cname-flattening/)
* `CNAME` flattening happens by default in some cases. Refer to [Setup](/dns/cname-flattening/set-up-cname-flattening/) for details.
* <Render file="cname-flattening-callout" />
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ head:

---

import { Render } from "~/components"
import { Render, TabItem, Tabs, GlossaryTooltip } from "~/components"

:::note

Expand All @@ -25,24 +25,51 @@ If the `CNAME` target is on the same zone as the `CNAME` record, Cloudflare proc

## For all CNAME records

Accounts on paid plans can choose to flatten all `CNAME` records on their domain. This option is useful for DNS-only (unproxied) `CNAME` records since proxied records are flattened by default (as they return Cloudflare IPv4 and IPv6 addresses).
For zones on paid plans, you can choose to flatten all `CNAME` records. This option is useful for <GlossaryTooltip term="proxy status">DNS-only (unproxied)</GlossaryTooltip> `CNAME` records. [Proxied records](/dns/manage-dns-records/reference/proxied-dns-records/#proxied-records) are flattened by default as they return Cloudflare anycast IPs.

<Tabs syncKey="dashPlusAPI"> <TabItem label="Dashboard">

1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/login) and select your account and domain.
2. Go to **DNS** > **Settings**.
3. For **CNAME Flattening**, select **Flatten all CNAMEs**.
3. Turn on the option **CNAME flattening for all CNAME records**.

</TabItem> <TabItem label="API">

Make a `PATCH` request to the [Update DNS Settings](/api/operations/dns-settings-for-a-zone-update-dns-settings) endpoint and set `flatten_all_cnames` to `true` in the request body.

</TabItem> </Tabs>

:::caution
<Render file="cname-flattening-callout" />
:::

## Per record

Accounts on paid plans also have the option to flatten specific `CNAME` records. This operation is currently only supported via API.
Paid zones also have the option of flattening specific `CNAME` records.

<Tabs syncKey="dashPlusAPI"> <TabItem label="Dashboard">

1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/login) and select your account and domain.
2. In **DNS** > **Settings**, make sure that **CNAME flattening for all CNAME records** is turned off.
3. Go to **DNS** > **Records** and find the CNAME record you would like to flatten.
4. Select **Edit** and turn on the **Flatten** option.
5. Select **Save** to confirm.

:::note[Unavailable flatten option]
For the following cases, **Flatten** will not be available:
- The record is at the [zone apex](#for-your-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.
:::

</TabItem> <TabItem label="API">

With the available [API endpoints](/api/operations/dns-records-for-a-zone-create-dns-record), specify the following for each `CNAME` record in the request body:

```txt
"settings": {
"flatten_cname": true
}
```
```

</TabItem> </Tabs>
2 changes: 1 addition & 1 deletion src/content/partials/dns/cname-flattening-callout.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

---

If a `CNAME` target is being used to verify a domain for a third-party service, enabling the [Flatten all CNAMEs](/dns/cname-flattening/set-up-cname-flattening/#for-all-cname-records) setting may cause that functionality to work incorrectly since the `CNAME` record itself will not be returned directly.
If a `CNAME` target is being used to verify a domain for a third-party service, turning on [CNAME flattening for all CNAME records](/dns/cname-flattening/set-up-cname-flattening/#for-all-cname-records) may cause the verification to fail since the `CNAME` record itself will not be returned directly.
Loading