When you add a DNS record, a "record conflict" error may prevent you from saving it. This error typically occurs because the CNAME record that you want to add conflicts with an existing record for the same host, such as an A record or an MX record.
Use case: switch from an A record to a CNAME record for acceleration
To minimize the impact on your services during the switch, perform this operation during off-peak hours.
Procedure
In the Alibaba Cloud CDN console, add your domain name and configure its CNAME record. Ensure that the CNAME address is active.
Lower the TTL of the existing A record.
Log on to the Alibaba Cloud DNS console and navigate to the Settings page for the target domain name.
Find the A record for the host, such as
www. Change its TTL to the minimum value that your edition supports:Personal Edition: 10 minutes.
Ultimate Edition: 60 seconds or less. For example, you can set the TTL to 10 seconds.
Wait for a period equal to the original TTL value. For example, if the original TTL was 10 minutes, wait for at least 10 minutes. This ensures that DNS caches across the globe are updated with the new TTL.
Switch to the CNAME record. Perform the following steps to minimize downtime.
Delete the original A record.
Add the CNAME record.
Parameter
Example value
Description
Record type
CNAMERequired
Host
wwwSame as the original record
Record value
example.cdn.aliyun.com.Copy this from the Alibaba Cloud CDN console. Do not omit the trailing dot (
.).TTL
Set to the value recommended by Alibaba Cloud CDN (usually 10 minutes).
You can keep the default value.
Use case: use a root domain for both a website and an email service
To avoid a conflict between CNAME and MX records, you can use URL forwarding. This method redirects HTTP and HTTPS requests from the root domain to a subdomain, such as www, that is configured with a CNAME record.
Procedure
Ensure that both the root domain (the source domain) and the
wwwsubdomain (the destination domain) have a valid Internet Content Provider (ICP) filing. This is a requirement for services hosted in mainland China.Add a CNAME record for the
wwwsubdomain. Set the value of the record to the address provided by Alibaba Cloud CDN, such asexample.cdn.aliyun.com..Add an explicit URL forwarding record for the root domain (
@). Set the destination tohttps://www.example.com.Retain the MX record for the root domain (
@) to handle your email service.
This solution applies only to web access. Other protocols, such as API calls or email client connections, cannot use URL forwarding to access the root domain.
Verify the configuration
After you change the DNS records, wait for the changes to propagate worldwide. You can then run the following commands to verify your configuration:
# Verify the CNAME record
dig www.example.com CNAME +short
# Expected output: example.cdn.aliyun.com.
# Verify the MX record
dig example.com MX +short
# Expected output: 10 your-mail-server.com.