SecDNS

CNAME record

A CNAME record creates a canonical alias from one DNS name to another, instructing resolvers to repeat the query against the target name and inherit all its records.

CNAME record

A CNAME (Canonical Name) record is an alias that tells resolvers a given DNS name is just another name for a different "canonical" one — the resolver should follow the chain until it reaches non-CNAME records.

In plain English

If shop.example.com is really hosted by Shopify, you publish a CNAME from shop.example.com to mystore.shopify.com. When a browser looks up shop.example.com, DNS quietly redirects it to Shopify's record set without anyone having to know.

How it works

CNAME is defined in RFC 1035 §3.3.1 with type code 5. The rdata is a single domain name — the target. When a resolver receives a CNAME, it appends the target's address records to the response and continues following the chain; if the chain is long, it loops up to a small limit (commonly 8) before giving up. Critical rules: a name with a CNAME may have no other records of any other type (RFC 1034 §3.6.2), which is why apexes (example.com itself, which must have SOA and NS) cannot be CNAMEs. MX, NS, and DNSSEC records may not point to a CNAME target. Several DNS providers (including SecDNS) implement "ALIAS" or "ANAME" features that simulate apex CNAMEs by resolving the target server-side and synthesising A/AAAA responses.

  • DNS — base protocol
  • A record — what a CNAME typically resolves to
  • AAAA record — same, for IPv6
  • SOA — incompatible with CNAME at the apex
  • MX record — cannot target a CNAME
  • TTL — both the CNAME and its target have TTLs
  • SRV — also cannot target a CNAME

SecDNS perspective

SecDNS supports CNAME chains, lints them for forbidden combinations, and offers an ALIAS record that lets you point your apex at an upstream hostname without breaking SOA or NS.

Frequently asked questions

Why cannot the zone apex have a CNAME?

RFC 1034 forbids a CNAME at the same name as any other record. Apex records like SOA and NS are mandatory, so no CNAME can live there. ALIAS or ANAME are vendor-specific workarounds.

How long can a CNAME chain be?

No formal limit, but most resolvers cap chains at around 8 hops to prevent loops. Long chains slow down resolution and should be avoided.