CNAME Flattening: RFC-Compliant CNAMEs at a Domain's Root
blog.cloudflare.com
blog.cloudflare.com
This problem would not exist if clients (eg. web browsers) supported SRV record lookups. The SRV fixes a missing abstraction by mapping names that users see (eg. foo.com) to actual server names (eg. webserv42.foo.com). Without SRV record lookups, web browsers must look up the bare domain, and expect to get an address, for this to work. CNAMEs were not designed to be used for this kind of situation; it's a square peg in a round hole.
This isn't due to the inflexibility of DNS; it's due to the inflexibility of clients that ignore newer advancements in the protocol.
Of course, this does mean that web hosts are stuck.
I.e. since HTTP does not specify the use of SRV records, web browsers are not allowed to use SRV lookups to locate HTTP servers.
The ones to blame are, instead, HTTP standards writers, which have not written a new HTTP standard taking advantage of the wonderful thing which SRV records are.
https://www.iana.org/assignments/service-names-port-numbers/...
There are not three, but thousands of protocol names registered.
HTTP, notably, does not specify the use of SRV records.
In general, it is expected that SRV records will be used by clients
for applications where the relevant protocol specification indicates
that clients should use the SRV record. Such specification MUST
define the symbolic name to be used in the Service field of the SRV
record as described below. It also MUST include security
considerations. Service SRV records SHOULD NOT be used in the absence
of such specification.
RFC2119 defines 'SHOULD NOT' as follows: This phrase, or the phrase "NOT RECOMMENDED" mean that
there may exist valid reasons in particular circumstances when the
particular behavior is acceptable or even useful, but the full
implications should be understood and the case carefully weighed
before implementing any behavior described with this label.“[…] the GET and HEAD methods SHOULD NOT have the significance of taking an action other than retrieval. These methods ought to be considered "safe". This allows user agents to represent other methods, such as POST, PUT and DELETE, in a special way, so that the user is made aware of the fact that a possibly unsafe action is being requested.
I would argue that very few people would claim that it’s OK for HTTP servers to have HEAD and GET requests be non-idempotent just because they feel like it. “SHOULD NOT” prohibitions should not be ignored just because you really want to do it.
$ dig +short srv _http._tcp.pkg.freebsd.org
20 10 80 pkg0.isc.freebsd.org.
50 10 80 pkg0.bme.freebsd.org.
10 10 80 pkg0.nyi.freebsd.org.
90 10 80 pkg0.ydx.freebsd.org.
Technically, though, it's not being used by/with a web browser.It generated enough confusion (as evidenced by the frequent "how come I can't {connect to|resolve} pkg.freebsd.org?" questions) that there's now an A RR and a page explaining it: http://pkg.freebsd.org/
CloudFlare uses CNAME Flattening to present a CNAME as an A record.
The CloudFlare server generating the response follows the CNAME chain
so that the response to the request from the client (for example, the
browser) contains only non-CNAME data -- usually, an IP address. This
effectively creates an A or an AAAA record. Without flattening,
CloudFlare would serve the CNAME record directly to the recursor
(the DNS resolver that translates the domain name to an IP address).
They just resolve the destination and serve it as an A record.It was described in the article but perhaps not as clearly:
"What happens is that, if there's a CNAME at the root, rather than returning that record directly we recurse through the CNAME chain ourselves until we find an A Record. At that point, we return the IP address associated with the A Record."
This isn't due to a lack of foresight in the spec, but people's misunderstanding of what a CNAME record actually means. A CNAME says that this name refers to the exact same thing as another name, including all subnames.
You can CNAME the "bare" example.com to foo.example.org, but it would involve getting the .com nameservers serve that record instead of NS records. By having NS and SOA records for example.com, you can no longer say that the two names are equivalent. Rather than having to define a merge algorithm (eg what happens if example.com and foo.example.org both have MX records?), the RFC simply rules out additional records on the alias.
This technology is not new, revolutionary or different in any way from what a bunch of other providers do (including AWS, who they even mention in the blog post as what they are a solution for).
But yet they write it like they have solved a major problem in a new way.
Super props to the Cloudflare team! (I'm being sincere here, they did a great job with the marketing part of this product)
> if you signed up via a hosting partner then you may have gotten a
> CNAME that...SNIP...will now resolve directly from your domain to an
> IP address. This makes DNS resolution a bit faster and also better
> obscures the fact that you're using CloudFlare.
To what end are we obscuring the use of cloudflare? And how useful is the "cloudflara obscura" if the responses are being served by the cloudflare machines listed in the NS records? dfc@fob-xray:~$ dig +short ns nasdaqprivatemarket.com
jill.ns.cloudflare.com.
igor.ns.cloudflare.com.
dfc@fob-xray:~$ dig +short ns skyprep.com
mark.ns.cloudflare.com.
vera.ns.cloudflare.com.
dfc@fob-xray:~$ dig +short ns econsultancy.com
cody.ns.cloudflare.com.
kay.ns.cloudflare.com.
dfc@fob-xray:~$ dig +short ns jct.com
ben.ns.cloudflare.com.
iris.ns.cloudflare.com.
I am not trying to be nit picky. I am genuinely curious, DNS is one of those things I find very interesting.In their defense, they didn't say it completely* obscures the use of CloudFlare.
Traffic balancing and redirection via DNS responses isn't new ground--other people just don't conflate it with CNAME kludgery.
It's also good to know that GeoDNS resolution won't work as expected since the location of the resolver is going to be the DNS provider and not the client.
EDIT: Actually DNSMadeEasy claims that the resolution is done locally in each of their region so the issue is somewhat mitigated.
DNSMadeEasy -> ANAME DNSimple -> ALIAS EasyDNS -> ANAME PointDNS -> ALIAS
You can ALIAS to record sets within your own zone too, which can contain any arbitrary IP. This is useful when composing routing types (e.g. weighted plus latency). But we don't support ALIASing to record sets hosted on other DNS providers.
It is possible to ALIAS to a CloudFront distribution though, and that CloudFront distribution can in turn use any arbitrary name as its origin. It's also possible to ALIAS to an S3 bucket, which can be configured with a redirect to any name of your choice.
Remote DNS-level ALIAS is something that we're always considering, and we're interested in feedback. If we support it, it's unlikely our 100% availability SLA will apply, that there may be inter-operability issues with CDNs (though we recently announced our support for edns-client-subnet: http://aws.typepad.com/aws/2014/04/improved-cloudfront-perfo...) and incompatibilities with our future DNSSEC support.
[0] http://joshstrange.com/why-its-a-bad-idea-to-put-a-cname-rec...
HN discussion: https://news.ycombinator.com/item?id=7293512
CF CEO commenting about CNAME flattening 28 days ago: https://news.ycombinator.com/item?id=7295215
dfc@fob-xray:~$ host www.netflix.com # local unbound dns
www.netflix.com is an alias for www.us-east-1.netflix.com.
www.us-east-1.netflix.com is an alias for www.us-east-1.prodaa.netflix.com.
www.us-east-1.prodaa.netflix.com has address 50.16.245.238
www.us-east-1.prodaa.netflix.com has IPv6 address 2406:da00:ff00::6b14:f251
dfc@fob-xray:~$ host www.netflix.com 8.8.8.8 # 8.8.4.4 Gives same response
Using domain server:
Name: 8.8.8.8
Address: 8.8.8.8#53
Aliases:
www.netflix.com is an alias for www.us-west-2.netflix.com.
www.us-west-2.netflix.com is an alias for www.us-west-2.prodaa.netflix.com.
www.us-west-2.prodaa.netflix.com has address 54.245.96.95
www.us-west-2.prodaa.netflix.com has IPv6 address 2620:108:700f::3270:5f36FWIW, Google has proposed a solution to this problem: http://tools.ietf.org/html/draft-vandergaast-edns-client-sub...
s/IP/IPv4/
Make people aware that v4 is history and present. Sure, we currently have to deal with it, but v6 and v4 should be treated equally. Esp. when talking about problems v6 solves.
IPv6 is here. If you're setting up a new service today without it you should be shot.
[0] https://www.dropbox.com/s/doazzo5ygu3idna/WorldIPv6Congress-...
In their theoretical problem, foo.com needs to be moved to somewhere else in a hurry to reduce an unpleasant load level. No problem--you simply change where foo.com points to. Normal people change the A record and call it a day. Why would you want to involve a CNAME in this? Perhaps if you needed to direct the query to some other server because it's managed by some other entity.
But wait... This requires the other entity to serve your DNS records. Not exactly a problem--even though it rather uncomfortably resembles a horizontal referral--so long as we exercise restraint, it only slows down the query a little bit. So now the lookup goes to the server your domain (foo.com) is hosted on, and needs to goes to the other server to get the foo.com.fancynametheycanmove.webprovider.com, except no... that won't really work because your DNS provider hosting foo.com would need to allow you to put CNAMEs at the root of the zone, and CNAMEs are singleton records.
The solution? Why it's to use webprovider.com to host your foo.com DNS as well! Then they can do this because their magic DNS server does all those other lookup steps for the querying client. But wait... if they're going to be hosting the foo.com zone, why don't they just change the A record in the first place? Why on /earth/ would it be useful to involve a bunch of CNAME jumps in that? For that matter, how is this even slightly usefully different than a normal global traffic manager issuing different responses for DNS based on load and server pool configuration that for the love of all that is holy I hope they already know about if they're trying to run a "cloud provider".
The reason we don't have CNAMEs in the root of zones isn't "because the standards are old" it's because CNAMEs are supposed to be a one-off which should be used sparingly because they can be used to create never-ending chains of indirection which cause serious problems for nameservers doing recursive resolution for their users. AOL used to regularly break nameservers all over the place with their casual use of endless loops of CNAME records.
I'm saying it's pointless to even ramble on about CNAMEs when the conditions necessary for this to /even work/ mean it would be just as easy to return an abstracted A record that points to the right/active resource in the first place... Like GTMs generally do /already/. When the query comes into the GTM for loadbalancedsite.com, the response isn't fixed--the GTM has already been keeping track of which nodes are up and/or potentially closest to the requestor and it simply hands back an A record with a reasonably short TTL without anyone having to pat themselves on the back for being 'clever'.
In other words, it's a hack to support broken cloud providers?
http://translate.google.de/translate?sl=de&tl=en&js=y&prev=_...
How Does This Improve CDN Services?
When combined with the Global Traffic Director service from DNS Made Easy, ANAME
records provide an extremely flexible and powerful solution to keep your CDN
service running optimally. As soon as an ANAME record is defined with a
particular GTD region (other than Default) the ANAME service ensures that
it will only use DNS Made Easy’s resolving name servers that are in that
particular region. For example, if you create an ANAME record with “Europe”
as the GTD region, then only resolving name servers in Europe would be used
to create the A records for this new record type. This ensures that your
traffic continues to be routed regionally as planned with your worldwide
infrastructure. Use of ANAME records are fully compatible with GTD service
and optimize use of a CDN provider. This provides the complete power
and flexibility that enterprise companies require from their networks today.Disclosure: I own rootredirect.com.
Grokking pointers is hard enough as is. I weep for all the wannabe systems programmers who will get confused by this otherwise very nice announcement.
or am I missing something?