Learn/Website

Do you need a CDN?

A CDN can make a site faster and sturdier, but it adds a layer someone has to own. When it helps, what it changes, and how to choose.

Want this checked on your own domain?

Join the waitlist

Updated

Questions for whoever manages your website

Hi, before we add or change a CDN, could you answer a few questions?

  1. Does our hosting already serve the site through a CDN?
  2. Who will own the CDN account, and who else can sign in?
  3. Which hostnames will it serve, and how will our DNS change?
  4. How are certificates issued and renewed, and does the CDN connect to our server over HTTPS?
  5. What will it cache, and how do we make sure logged-in pages, carts, and form results are never cached?
  6. How do we clear the cache, and how do we switch the CDN off if we need to?

Thank you.

Want this checked on your own domain? Join the waitlist.

Check yours

The “Your setup at a glance” section of the full report (join the waitlist for access) lists your DNS host when it recognizes your nameservers, any CDN or proxy it recognizes from your website’s response headers, and who issues your certificates.

When a CDN helps

At its core, a CDN works as a shared cache: it stores responses and reuses them for many visitors, which cuts both the time to answer and the traffic to your server (RFC 9111 §1). That pays off when:

  • visitors are spread across regions, far from your server;
  • pages carry heavy files that rarely change, such as images, scripts, stylesheets, and fonts;
  • traffic arrives in spikes that your server struggles with;
  • you want features some CDNs offer at the edge, such as bot filtering, rate limits, or firewall rules;
  • you want your server to accept traffic only from the CDN, so it isn’t exposed directly.

When it may not be worth it

  • Your host already does it. Some hosting platforms serve sites through a CDN of their own; a second one adds a layer without adding much. Ask your host.
  • The site is small and local. A light brochure site whose visitors are near the server may gain little.
  • Nobody would own it. An unowned CDN account is a risk: certificates, rules, and billing need someone who can sign in.
  • Most pages are personal. Logged-in areas, carts, and dashboards can’t be shared between visitors, so a cache helps them little and needs careful rules.

What a CDN changes

DNS

To send visitors to the CDN, you change DNS records for each hostname it serves:

  • A subdomain such as www.example.com can point at the CDN with a CNAME (alias) to a hostname the CDN gives you.
  • The bare domain example.com can’t be a CNAME. A name with a CNAME may hold no other records (RFC 1034 §3.6.2, RFC 2181 §10.1), and the top of every zone must hold its SOA and NS records (RFC 2181 §6.1). RFC 9460 §2.4.2 notes the same limitation. The ways around it are A and AAAA records with addresses the CDN provides, a DNS host’s own apex-alias feature (Cloudflare calls its version CNAME flattening), or moving your nameservers to the CDN’s DNS service.
  • Moving nameservers to the CDN is a change of DNS host. Copy every record first, including email records, and follow changing DNS hosts safely. If DNSSEC is on, handle it before the move; Cloudflare’s own onboarding instructions say to turn DNSSEC off at the registrar first.

Certificates

A CDN that handles HTTPS acts as a gateway: it is the server your visitors connect to, and it makes its own, separate connection to your server (RFC 9110 §3.7). That means two certificates matter:

  • Visitor to CDN. The CDN must present a valid certificate for each of your hostnames. Make sure it has one before you switch DNS, or visitors see certificate errors. See TLS certificates.
  • CDN to your server. This connection should also use HTTPS, with the CDN checking your server’s certificate. Over plain HTTP, the traffic between the CDN and your server isn’t encrypted, even though visitors see a padlock; without the certificate check, the CDN can’t tell your server from an impostor.

If your domain publishes CAA records, they must allow the certificate authority the CDN uses: a CA must check CAA before every issuance (Baseline Requirements §4.2.2.1). See CAA records. And if DNSSEC validation fails for your domain, a CA must not treat that as permission to issue (§4.2.2.2.5).

Caching

What a shared cache may store is set by your server’s Cache-Control header, and a CDN’s own rules can add to that. The directives that matter most:

DirectiveEffectRFC 9111
privateShared caches must not store the response; the visitor’s browser may§5.2.2.7
no-storeNo cache may store it at all§5.2.2.5
s-maxage=<seconds>How long shared caches may reuse it, overriding max-age for them§5.2.2.10
max-age=<seconds>How long any cache may reuse it§5.2.2.1
Vary: <header>The response differs by that request header; caches reuse it only for requests whose value of that header matches§4.1

Two rules prevent the worst failure, one visitor’s page shown to another:

  • Send Cache-Control: private or no-store on every page that differs per visitor: account pages, carts, checkout, and form results.
  • Don’t rely on defaults. A response with no explicit lifetime can still be cached by heuristics (RFC 9111 §4.2.2). A shared cache won’t reuse a response to a request carrying an Authorization header unless the response explicitly allows it (§3.5), but cookies get no such protection: a response that sets a cookie can still be cached and served to others (§7.3).

How to choose

Compare CDNs on these criteria rather than on reputation:

  • Ownership. The account belongs to your organization, more than one person can administer it, and sign-in uses two-factor authentication.
  • Fit with your host. It supports your platform, and the bare domain in the way you need: addresses for A and AAAA records, or an apex alias.
  • Certificates. It issues and renews certificates for your hostnames automatically; you know which certificate authority it uses, for CAA; and it connects to your server over HTTPS with certificate checks.
  • DNS. Whether it requires its own nameservers, and if so whether it supports DNSSEC.
  • Cache control. It honors Cache-Control, lets you purge by address, and makes it easy to exclude private pages.
  • Features you need. Security rules, redirects, or image optimization, only if you will use them.
  • Pricing. What is billed: traffic, requests, or features, and what happens in a traffic spike.
  • Exit. How to switch it off: which DNS records change back, and what stops working when you do.

Setting one up

  1. Confirm your host doesn’t already serve the site through a CDN.
  2. Decide which hostnames go through the CDN.
  3. Set up those hostnames at the CDN, with your server as the origin it fetches from.
  4. Make sure the CDN has a valid certificate for each hostname, and that it reaches your server over HTTPS.
  5. Add Cache-Control: private or no-store to personal pages before any traffic goes through the cache.
  6. If you publish CAA records, allow the CDN’s certificate authority.
  7. Change the DNS records, or the nameservers, following the DNS notes above.
  8. Test: the site loads over https, and logins, carts, and forms work for two different visitors. If the report recognizes your CDN, its “Your setup at a glance” section lists it.

Technical reference

  • Intermediaries. A gateway (reverse proxy) acts as the origin server for the client’s connection and forwards requests inbound to other servers; gateways are used for “accelerator” caching, partitioning, and load balancing (RFC 9110 §3.7).
  • Caches. A shared cache stores responses for reuse by more than one user; a private cache serves one user, usually inside the browser (RFC 9111 §1). A cache may assign heuristic freshness only to responses without explicit expiration whose status codes are heuristically cacheable, or that are marked public (§4.2.2).
  • CNAME at the apex. A CNAME can’t coexist with other data at the same name (RFC 1034 §3.6.2, RFC 2181 §10.1), and the zone apex must carry SOA and NS records (RFC 2181 §6.1). The HTTPS record’s AliasMode was designed to allow aliasing at the apex (RFC 9460 §2.4.2); clients that don’t support HTTPS records ignore it, so the apex still needs its A and AAAA records (RFC 9460 §10.4.2).
  • Certificate issuance. CAs must retrieve and process CAA records for each name in a certificate (Baseline Requirements §4.2.2.1) and must validate DNSSEC on those lookups and on domain-validation lookups, with validation errors not treated as permission to issue (§4.2.2.2).
  • What the report shows. Its “Your setup at a glance” section names your DNS host when it recognizes your nameservers, a CDN or proxy when your website’s response headers identify one, and the issuers of your certificates. The report doesn’t evaluate a CDN’s configuration or cache rules.

Sources

Want this checked on your own domain?

Join the waitlist
Domain Readiness

Free checks for email, website, DNS, and registration, with plain-English fixes.

Domain Readiness™ (domainreadiness.com) is a service of Riviera Learning, LLC.