Support >
  About cybersecurity >
  What to do if there is a DNS record conflict? The same host record cannot have both A and CNAME records simultaneously.

What to do if there is a DNS record conflict? The same host record cannot have both A and CNAME records simultaneously.

Time : 2026-07-28 10:05:19
Edit : DNS.COM

  DNS record conflicts can indeed be a headache, because you can't simply set both an A record and a CNAME record for the same hostname.

  The core reason behind this is a limitation of the DNS protocol (RFC 1034): CNAME records (aliases) have the highest priority. Once a CNAME record is set for a hostname, it means that this domain name is merely a "stand-in" for another domain name and cannot have any other type of record (such as A, MX, TXT, etc.). Otherwise, the DNS server would be in a state of confusion about "who to listen to."

  To solve this problem, you can choose the most suitable solution from the following options based on your specific needs.

  Option 1: Prioritize Website Access (Most common in CDN scenarios)

  If your requirement is to accelerate your website (e.g., www.example.com) through a CDN, and the CDN service provider requires configuring a CNAME record:

  Direct Replacement: This is the most direct method. In the DNS management console, locate the existing A record for www.example.com and delete it. Then, create a new CNAME record with the host record set to www, and enter the CNAME address provided by your CDN provider as the record value.

  Note: Smooth Switching: To avoid temporary website inaccessibility during the switch, you can first reduce the TTL (Time To Live) value of the deleted A record (e.g., to 60 seconds), wait for the original TTL cache to expire, and then perform the "Delete A Record, Add CNAME Record" operation. This will allow the switch to take effect faster.

  Solution Two: Website and Email Service Coexist (Common Scenario with Root Domain @)

  If your root domain example.com (host record set to @) is used for both a website and email, and you have already set a CNAME record for @, then the MX record cannot be added. This is because CNAME will hijack MX queries, causing the email service to malfunction.

  Fundamental Solution (Recommended): Discard the CNAME record for the root domain. Change the DNS resolution type of the root domain @ to A record, pointing to your server's IP address. Then, configure a separate MX record for the email service, pointing to your email service provider. This is the most compliant with DNS standards.

  Alternative Method (Website Access Only): If the root domain @ cannot use an A record, you can configure URL forwarding. Retain the root domain @'s MX record for email, and add an explicit URL record to redirect all HTTP access to example.com to www.example.com. This method only works for web access and does not affect email sending and receiving.

  Solution 3: Using Line Splitting (Fine Control)

  If you want to retain both A and CNAME records and want users in different regions to access different destinations (e.g., domestic users access the origin IP, overseas users go through a CDN), this requires your DNS provider to support line-based resolution.

  Retain the existing A record, but change its resolution request origin to "Mainland China" or "Default".

  Create a new CNAME record with the same host record, but set its resolution request origin to "Overseas", and fill in the CDN address as the record value.

  In this way, the DNS server will return different resolution results based on the visitor's IP address, achieving perfect coexistence.

  More Advanced Alternatives: ALIAS/ANAME Records

  If your domain registrar (such as Cloudflare, AWS Route 53, etc.) supports this, you can use special record types like ALIAS or ANAME. Essentially, it simulates the effect of a CNAME record internally within the DNS provider's servers, but it responds externally as an A record. Therefore, it can coexist with other records like MX records, making it a powerful tool for resolving root domain conflicts.

  Summary and Operational Recommendations:

  In general, the key to resolving conflicts is to make trade-offs or use more flexible technologies based on your primary business needs.

  If it's a subdomain (e.g., www) requiring CDN configuration: Deleting the A record and adding a CNAME record is the standard practice.

  If it's a root domain (@) requiring both a website and email: Changing the website's DNS resolution to an A record and configuring a separate MX record for the email is the safest solution.

  If you must use a CNAME record and cannot abandon it: First, check if your DNS provider supports route splitting or ALIAS/ANAME records.

  Before making any changes, it is recommended to take a complete screenshot or export a backup of your existing DNS records, just in case. After making changes, you can verify that the new configuration has taken effect by using `dig yourdomain record type` or an online DNS checker.

DNS Amy
DNS Luna
DNS Anna
DNS NOC
Title
Email Address
Type
Information
Code
Submit