CloudFlare CDN and static site with root on Amazon S3

Harper asked:

I’ve set up an S3 bucket to host my static site.

Now I am trying to wrap CloudFlare around this, but I get the following warning when adding a CNAME entry for the root domain in CloudFlare’s DNS manager:


Root domain CNAME records are not allowed by the DNS specification.
Older recursors and mail programs may not follow this CNAME. You may
want to change this record to an A record if you plan to use it as a
MX or SRV target.

The examples I’ve found show a working setup using a subdomain (i.e. per but I am interested in hosting the site entirely from the root domain.

Everything appears to work right now… The domain is setup with Google Apps MX records – can I ignore the warning from CloudFlare? I would feel more comfortable being able to set the root domain as an A record, but I’m not sure how to achieve this.

My answer:

When your email stops coming in tomorrow, you’ll know that it wasn’t safe to ignore this warning.

The CNAME replaces all other resource records, so it overrides the SOA record, MX records and any other records you might have defined for the zone. That’s why it’s strongly recommended against. (And why providers recommend you not use the naked domain in preference to www.)

If you’re on Route 53, they have a workaround to make this “work” (though it’s ugly and nasty behind the scenes). It sounds like CloudFlare has the same sort of workaround in place. It’s probably equally nasty, but you should be able to do it.

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.