Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

CDN Errors: How to Find the Cause and Fix It

· 6 min read · Home Tech

In this article
  1. What CDN Errors Usually Are
  2. Six Checks That Pin Down a CDN Error
  3. Which Layer Is Failing, and the Fix for Each
  4. Quick-Checks Checklist Before You Dig Deeper
  5. Symptom, Likely Cause, and Fix at a Glance
  6. When Is the CDN Itself the Problem?

Most CDN errors are fixed by clearing your local cache, retrying from a different network, or purging the CDN cache after a deploy. If a 5xx error code appears, the origin server or its configuration is usually the real culprit, not the CDN itself.

Time 20 min · Steps 6 · Level Medium

Start here: reload with cache bypassed, then check whether the CDN or the origin is at fault. A hard refresh (Ctrl+F5 on Windows, Cmd+Shift+R on a Mac) forces your browser to fetch the file fresh from the CDN instead of its own cache. If the file loads, your problem was a stale cached copy, and the fix is a cache purge. If it still fails, the error is either between the CDN and your origin server, or in the CDN configuration itself.

What CDN Errors Usually Are

A CDN error almost always shows up as a page or asset that fails to load, often with a status code in the 4xx or 5xx range and sometimes a branded error page from the CDN provider. The CDN sits between visitors and your origin server, so a failure can come from three places: the visitor's side, the CDN's edge servers, or the origin. The status code is your first clue. 403 and 404 point to permissions or missing files, 502 and 504 point to the origin being unreachable or too slow, and 520-526 are codes some providers use when the origin returns something unexpected or the connection fails. Note that exact code numbering can differ slightly between providers, so check your provider's own error-code documentation.

Six Checks That Pin Down a CDN Error

  1. Hard refresh and clear browser cache. Press Ctrl+F5 or Cmd+Shift+R. If the asset loads, the bad copy was cached locally and nothing is broken server-side.
  2. Test from another network or device. Switch to mobile data or another Wi-Fi. If it works there, the problem is your network, DNS or a local block, not the CDN.
  3. Read the exact status code. Open the browser's developer tools, Network tab, reload, and click the failing request. The code tells you which layer to investigate next.
  4. Check the origin directly. Request the file from the origin server (bypass the CDN hostname, or use a hosts-file override if needed). If the origin fails too, fix the origin first.
  5. Purge the CDN cache. In the provider's dashboard, purge the specific URLs or the whole cache. A purge forces the edge to fetch fresh copies from the origin.
  6. Review DNS and SSL settings. Confirm the CNAME or A records still point at the CDN, and that the SSL/TLS mode matches what the origin supports (full validation, not flexible, if the origin has a valid certificate).

Which Layer Is Failing, and the Fix for Each

Stale or poisoned cache

This is the most common cause after a deployment: the CDN keeps serving an old copy of a file, or a bad copy got cached. Confirm it by comparing the file served through the CDN with the same file fetched directly from the origin. Fix it with a cache purge in the provider dashboard, and prevent repeats by setting proper Cache-Control headers so HTML is short-lived (minutes) while versioned assets with hashed filenames are cached long (months). Because hashed filenames change on every build, you never need to purge them.

Origin server down or slow

A 502 or 504 usually means the CDN asked the origin for the file and got no answer, or an answer after the CDN's timeout. Confirm by loading the origin directly, or by checking the origin's own monitoring. Fix the origin: restart it, free up resources, or raise the CDN's origin timeout if the origin legitimately needs more time. If the origin is fine but only sometimes slow, look at origin connection limits.

Wrong DNS or SSL configuration

If DNS no longer points at the CDN, or the certificate between CDN and origin is invalid or expired, requests fail before content is ever fetched. Confirm with a DNS lookup of your domain and by loading the origin over HTTPS directly. Fix by correcting the records, and setting the CDN's SSL mode to full strict when the origin has a valid certificate. A mismatch, such as flexible SSL pointing at an HTTPS-only origin, produces redirect loops or handshake errors.

Blocked requests and firewall rules

A 403 from the CDN often means a firewall or bot-protection rule on the CDN, or on the origin, is rejecting the visitor. Confirm by checking the CDN's security event log for the blocked request. Fix by adjusting the rule, whitelisting the origin's own firewall for the CDN's IP ranges, or disabling the over-aggressive rule. If the origin firewall blocks the CDN's servers, only some visitors see errors, which makes this one easy to miss.

Missing or misrouted files

A 404 through the CDN can mean the file genuinely does not exist at the origin, or the CDN is rewriting paths incorrectly. Confirm by requesting the exact URL at the origin. Fix the file path, or correct the CDN's rewrite and redirect rules. This often appears after a site migration when old URLs were never mapped.

Quick-Checks Checklist Before You Dig Deeper

  • Hard refresh done, error still present?
  • Same error from a second network and a second browser?
  • Status code noted from the developer tools Network tab?
  • Origin tested directly, bypassing the CDN hostname?
  • CDN cache purged for the failing URLs?
  • DNS records and SSL mode verified in the provider dashboard?
  • CDN provider's status page checked for an ongoing incident?

Symptom, Likely Cause, and Fix at a Glance

SymptomLikely causeFix
Old file version still showingStale CDN cachePurge the cache; add hashed filenames and proper Cache-Control headers
502 or 504 error pageOrigin down, slow, or unreachableFix or restart the origin; raise origin timeout if needed
403 on some or all requestsFirewall or bot rule blocking visitorsCheck the CDN security log; adjust rules; whitelist CDN IPs at the origin
404 for a file that existsPath rewrite or routing rule errorFix the rewrite rules or the file path at the origin
Redirect loop or SSL warningSSL mode mismatch between CDN and originSet SSL to full strict; renew the origin certificate
Works for you, fails for othersRegional edge issue or origin firewallCheck the provider status page; whitelist CDN IP ranges at the origin
Whole site suddenly offlineDNS no longer pointing at the CDNCorrect the CNAME or A records; wait for DNS propagation, typically minutes to a few hours

When Is the CDN Itself the Problem?

If every check passes, the origin serves the file correctly, DNS and SSL are right, and errors still appear for visitors in specific regions, the CDN's edge network may be having an incident. Check the provider's own status page before changing anything, because configuration changes made during an outage often cause a second problem once the incident clears. If errors persist after the provider reports recovery, purge the full cache once, then re-test from the affected region using a testing tool that fetches from multiple locations. As a last resort, temporarily pointing DNS back at the origin lets you serve visitors directly while you work with the provider's support, at the cost of losing the CDN's speed and load protection.

Official source: Cloudflare Help Center