All Products
Search
Document Center

CDN:Add a CNAME record for a domain name

Last Updated:Feb 21, 2024

After you add a domain name to Alibaba Cloud CDN, the system assigns a CNAME record to the domain name. You must add a CNAME record in the system of your DNS service provider to map the domain name to the CNAME before requests can be redirected to points of presence (POPs).

Background information

How it works

After you add a domain name to Alibaba Cloud CDN, the system assigns a CNAME to the domain name. You must map the accelerated domain name, such as example.aliyundoc.com, to the assigned CNAME such as example.aluyundoc.com.w.cdngslb.com. This way, client requests can be forwarded to POPs to accelerate content delivery. For more information, see How it works.

Domain name resolution

Domain name resolution is the process of converting a domain name, such as example.aliyundoc.com, into an IP address of the client. For more information, see What is DNS resolution?

Prerequisites

A domain name is added by following instructions in Add a domain name.

Step 1: Obtain the CNAME record of the accelerated domain name

Go to the Domain Names page in the Alibaba Cloud CDN console and copy the CNAME record of the accelerated domain name.

域名管理

Step 2: Add a CNAME record

Different DNS service providers have different methods to add CNAME records.

Important
  • If you have configured an A record for the accelerated domain name, to avoid service interruptions, you must verify that the accelerated domain name is accessible by following instructions in (Optional) Test whether a domain name is accessible. Then, disable the A record and map the accelerated domain name to the CNAME record.

  • If you add a CNAME record for a wildcard domain name such as *.aliyundoc.com, the second-level domain names such as example.aliyundoc.com of the wildcard domain name can be accelerated, while the third-level domain names cannot. For more information, see Does Alibaba Cloud CDN support wildcard domain names?

  • Make sure that the DNS records do not conflict with each other in the same system.

  • The server that Alibaba Cloud CDN uses for domain name resolution is deployed in the Chinese mainland. If you configure region-specific DNS settings for your domain name, for example, you add a CNAME record for your Alibaba Cloud CDN-accelerated domain name only in regions outside the Chinese mainland, including Hong Kong (China), Macao (China), and Taiwan (China), the domain name cannot be mapped to the CNAME. The CNAME status is Pending Configuration in the Alibaba Cloud CDN console. However, acceleration for the domain name is not affected.

  • CNAMEs that are assigned by Alibaba Cloud CDN, DCDN, ApsaraVideo Live, and ApsaraVideo VOD can be used only for domain name resolution. If Alibaba Cloud detects that your CNAME is used for unauthorized or malicious activities, Alibaba Cloud reserves the right to close your Alibaba Cloud account and remove the domain names.

Add a CNAME record on Alibaba Cloud

If your DNS service provider is Alibaba Cloud, perform the following steps to add a CNAME record for the domain name:

  1. Log on to the Alibaba Cloud DNS console with the Alibaba Cloud account to which the domain name belongs.

  2. Optional. In the Alibaba Cloud DNS console, add a domain name that is not registered with Alibaba Cloud.

    Note

    If the domain name is not registered with Alibaba Cloud, you need to add the domain name to Alibaba Cloud DNS before you can add a DNS record for it. For more information, see Manage domain names. If the domain name is registered with Alibaba Cloud, skip this step.

  3. On the Domain Name Resolution page, find the domain name that you want to manage and click DNS Settings in the Actions column.

  4. Click Add DNS Record to add a CNAME record.

    Note

    The CNAME record of a specific domain name takes precedence over that of a wildcard domain name. If you want to accelerate a wildcard domain, where the DNS record contains an asterisk (*), you need to delete all other DNS records that match the wildcard domain.

    添加记录

    Parameter

    Description

    Example

    Record Type

    Select CNAME from the drop-down list.

    CNAME

    Hostname

    • For root domains, enter @.

    • For wildcard domains, enter *.

    • For subdomains, enter the prefix of the subdomain.

    For more information about subdomains, see Basic concepts.

    • Root domains

      • aliyundoc.com: @

      • aliyundoc.com.cn: @

    • Wildcard domains:

      • .aliyundoc.com: *

      • .aliyundoc.com.cn: *

      • *.example.aliyundoc.com: *.example

      • *.example.aliyundoc.com.cn: *.example

    • Subdomains

      • example.aliyundoc.com: example

      • example.aliyundoc.com.cn: example

      • www.example.aliyundoc.com: www.example

      • www.example.aliyundoc.com.cn: www.example

    Note

    .com.cn is a top-level domain that consists of two hierarchical levels.

    DNS Request Source

    Select Default from the drop-down list.

    We recommend that you keep the default setting.

    Record Value

    Enter the CNAME of the domain name.

    Note

    Each accelerated domain name is assigned a unique CNAME. Subdomains cannot use the CNAME of the root domain. If you want to accelerate a subdomain, add the subdomain to Alibaba Cloud CDN. Alibaba Cloud then assigns a CNAME to the subdomain. Alternatively, you can add a wildcard domain name to Alibaba Cloud CDN. Subdomains that match the wildcard domain name are mapped to the CNAME of the wildcard domain name. For more information, see Add a domain name.

    www.example.com.w.kunlunsl.com

    TTL

    Enter a time-to-live (TTL) value for the record. A smaller value indicates that the record is updated quicker. The default TTL value is 10 minutes.

    We recommend that you keep the default setting.

  5. Click OK.

Add a CNAME record on Tencent Cloud

If your DNS service provider is Tencent Cloud, perform the following steps to add a CNAME record for the domain name:

  1. Log on to the DNSPod console.

  2. On the DNSPod page, click Add Records to add a CNAME record.

    Parameter

    Description

    Example

    Host

    • For root domains, enter @.

    • For wildcard domains, enter *.

    • For subdomains, enter the prefix of the subdomain.

    • Root domains

      • aliyundoc.com: @

      • aliyundoc.com.cn: @

    • Wildcard domains:

      • .aliyundoc.com: *

      • .aliyundoc.com.cn: *

      • *.example.aliyundoc.com: *.example

      • *.example.aliyundoc.com.cn: *.example

    • Subdomains

      • example.aliyundoc.com: example

      • example.aliyundoc.com.cn: example

      • www.example.aliyundoc.com: www.example

      • www.example.aliyundoc.com.cn: www.example

    Note

    .com.cn is a top-level domain that consists of two hierarchical levels.

    Type

    Select CNAME.

    CNAME

    Split Zone

    Select Default.

    We recommend that you keep the default setting.

    Value

    Enter the CNAME of the domain name.

    Note

    Each accelerated domain name is assigned a unique CNAME. Subdomains cannot use the CNAME of the root domain. If you want to accelerate a subdomain, add the subdomain to Alibaba Cloud CDN. Alibaba Cloud then assigns a CNAME to the subdomain. Alternatively, you can add a wildcard domain name to Alibaba Cloud CDN. Subdomains that match the wildcard domain name are mapped to the CNAME of the wildcard domain name. For more information, see Add a domain name.

    www.example.com.w.kunlunsl.com

    Weight

    You do not need to set this parameter.

    N/A

    MX

    You do not need to set this parameter.

    N/A

    TTL

    Enter a TTL value for the CNAME record. A smaller value indicates that the record is updated quicker.

    We recommend that you keep the default setting.

  3. Click Confirm.

Step 3: Verify that the CNAME record takes effect

  • Method 1: Use the Alibaba Cloud CDN console

    1. Log on to the Alibaba Cloud CDN console and navigate to the Domain Names page.

    2. Find the domain name and move the pointer over the CNAME Status column. If the CNAME status is Configured, the CNAME has taken effect.image.png

      Note

      If you add a CNAME record, it takes effect immediately. If you modify a CNAME record, it takes 10 minutes for the update to take effect because the default TTL value of a CNAME record is 10 minutes. During this period, the CNAME status may be displayed as Pending configuration in the Alibaba Cloud CDN console until the update takes effect. The actual time period varies based on the TTL value that you specify for the CNAME record.

  • Method 2: Run the nslookup command

    1. Start Command Prompt in Windows or Terminal in macOS or Linux.

    2. Run the nslookup -type=CNAME domainName command. If the CNAME record in the output is the same as the CNAME record that is assigned to the domain name in the Alibaba Cloud CDN console, Alibaba Cloud CDN acceleration takes effect for the domain name.image.png

What to do next

After you complete the preceding steps, you can configure features of Alibaba Cloud CDN for your domain name. For more information, see Features.