24

We are hosting the page of many of our customers. We want to be able to provide our customers with a subdomain of our own domain like customerpages.ourdomain.com so they can create a CNAME to this subdomain.

www.customer1.com CNAME customerpages.ourdomain.com.  {This will work just fine.}

But the situation is I don't know if all our customers will be able to place the following CNAME

customer1.com CNAME customerpages.ourdomain.com

This last CNAME looks like it's against the RFC of DNS.

Any thoughts will be appreciated.

Geo
  • 8,663
  • 13
  • 63
  • 93

2 Answers2

23

No, you can't do that - CNAME records can only exist as single records and not combined with any other resource record (DNSSEC records excepted).

There are explicit SOA and NS records always present at the top of each domain, so that prevents the use of the CNAME at the same part of the hierarchy.

Alnitak
  • 334,560
  • 70
  • 407
  • 495
  • 1
    Can you say anything as to why a SOA and NS prevents a CNAME? Seriously, I don't understand. Is this some god-given limitation or is there some technical ambiguity preventing a CNAME at the same level as a SOA and NS from functioning? – Sven Aug 23 '13 at 01:14
  • @Sven see §3.6.2 of RFC 1034. – Alnitak Aug 23 '13 at 06:31
  • 2
    @Sven The problem is that RFC1034 predates [RFC2119](https://www.ietf.org/rfc/rfc2119.txt) and the phrasing "no other data *should* be present" is used, which leaves it open to interpretation. §6.1 and §10.1 of RFC2181 make the rules more explicit [when interpreted together](http://serverfault.com/a/613830/152073). – Andrew B Aug 21 '14 at 18:58
  • For those interested in a more thoroughly detailed article, Cloudflare has a great [blog post](https://blog.cloudflare.com/introducing-cname-flattening-rfc-compliant-cnames-at-a-domains-root/) on this in which they explain how they apply `CNAME Flattening` to work around this. TLDR: Quote: "Technically, the root could be a CNAME but the RFCs state that once a record has a CNAME it can't have any other entries associated with it" – xorinzor Aug 18 '23 at 19:11
2

It's true, given a domain example.com, some DNS servers (tinydns for one) won't complain if you set up CNAME records for both example.com and www.example.com. But still I'd avoid it as it would break e-mail for example.com (see RFC 2821 "Address Resolution and Mail Handling").

Community
  • 1
  • 1
drench
  • 231
  • 1
  • 5