> ## Documentation Index
> Fetch the complete documentation index at: https://docs.preprod.world/llms.txt
> Use this file to discover all available pages before exploring further.

# Create records in zone apex (CNAME flattening)

CNAME flattening is a Gcore Managed DNS feature that resolves CNAME chains at the zone apex to A or AAAA records, bypassing the RFC 1034 restriction that prevents CNAME records from coexisting with mandatory NS and SOA records.

## Zone apex record restrictions

[CNAME records](/dns/dns-records#cname-record) are increasingly used to integrate domains with CDNs and other services that route traffic through dynamically assigned IP addresses. Using an A record, which specifies the concrete IP address that resolves the domain, may not be suitable in cases where IP addresses change frequently based on the geolocation of requests.

According to the RFC 1034 specification, a CNAME record cannot coexist with other records. Therefore, it is impossible to specify a CNAME record for the root domain, also known as the "apex domain" (e.g., sample-test.com), because it has mandatory NS and SOA records.

While using a subdomain (e.g., cdn.sample-test.com) for CNAME record creation can be sufficient, some website owners may want to integrate their root domain. For this situation, Gcore Managed DNS provides the CNAME flattening feature.

## CNAME flattening mechanism

CNAME flattening is a mechanism that allows specification restrictions to be bypassed, enabling a CNAME to be specified for the root domain. It resolves the CNAME chain and uses the IP address of the final A or AAAA record. This synthetic record is then cached, respecting its TTL, and used to answer subsequent DNS queries for the apex domain on the Gcore DNS side.

By using CNAME flattening, we avoid specification violations, and DNS resolution works correctly in more cases. The local cache layer also decreases total resolution time, as cached responses serve subsequent queries directly.

## Configuration of CNAME flattening

Gcore Managed DNS provides CNAME flattening to customers on all plans by default.

<Steps>
  <Step title="Navigate to the Records tab">
    In the [Gcore Customer Portal](https://portal.gcore.com), navigate to **DNS** → **Managed DNS**, click the zone name, and open the **Records** tab.
  </Step>

  <Step title="Delete the A record">
    Click the delete icon next to the A record for the root domain. In the **Delete record** dialog, click **Yes, delete**.

    <Frame>
      <img src="https://mintcdn.com/gcore-docs/xkpzeHgKKKD4ZA-j/images/docs/dns/dns-records/specify-cname-at-root/specify-cname-at-root-image1.png?fit=max&auto=format&n=xkpzeHgKKKD4ZA-j&q=85&s=57a4fa60b83c8db1aed3109adfd76eb1" alt="Delete an A record at the root domain" width="1400" height="667" data-path="images/docs/dns/dns-records/specify-cname-at-root/specify-cname-at-root-image1.png" />
    </Frame>
  </Step>

  <Step title="Add a CNAME record">
    Click **Add record** and configure the new record:

    1. Set **Type** to **CNAME**.
    2. In the **Name** field, enter the root domain.
    3. In the **Content** field, enter the target domain.
    4. Click **Add**.

    <Frame>
      <img src="https://mintcdn.com/gcore-docs/xkpzeHgKKKD4ZA-j/images/docs/dns/dns-records/specify-cname-at-root/specify-cname-at-root-image2.png?fit=max&auto=format&n=xkpzeHgKKKD4ZA-j&q=85&s=60ac6ab129a47f2c3f4b53d5833ce277" alt="Add a CNAME record to the apex zone" width="1057" height="604" data-path="images/docs/dns/dns-records/specify-cname-at-root/specify-cname-at-root-image2.png" />
    </Frame>
  </Step>
</Steps>

Gcore Managed DNS supports CNAME flattening only when the zone apex contains a single CNAME record. The [Gcore DNS Lookup](https://gcore.com/dev-tools/dns-lookup) tool verifies the CNAME record's resolved value.
