Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Cloudflare 520-526 errors: how to find and fix origin errors

OPS-113High impactDetectedBy FunnelGuardPublished Updated
On this page

What this issue is

Cloudflare sits between your visitors and your origin (your hosting server). When Cloudflare cannot get a proper reply from the origin, it shows its own error page with a 52x code. The CDN is not the problem. The link between Cloudflare and your server is.

What each Cloudflare 52x code usually means
CodeMeaningCommon cause
520Unknown or empty response from originOrigin crashed, sent invalid headers, or a firewall or PHP error cut the reply
521Web server is downOrigin is offline, or it refuses Cloudflare's connections
522Connection timed outOrigin is overloaded, or its firewall drops Cloudflare IPs
523Origin is unreachableWrong origin IP in DNS, or a routing problem
524A timeout occurredOrigin connected but took too long to answer (a slow script or query)
525SSL handshake failedOrigin has no working SSL on port 443, or the SSL setup is incompatible
526Invalid SSL certificateOrigin certificate is expired, self-signed or for another hostname while SSL mode is Full (strict)

Why it costs you leads or sales

A visitor who lands on a Cloudflare error page cannot see your form, cart or booking button. Paid clicks still get charged, but no conversion can happen. Errors are often partial: one page, one form post, or only some regions, so you may not notice from the homepage.

Where the journey breaks
  1. Ad clickVisitor clicks your ad
  2. Cloudflare edgeRequest reaches the CDN
  3. Origin serverNo valid reply (52x)
  4. Landing page / formNever shown
  5. Lead or saleNot created

The visitor reaches Cloudflare, but the origin fails, so every later step is lost.

Lost conversions during an origin outageExample numbers
Lost conversions during an origin outage (example)Normal day: 40 leads per day; Day with 6h of 522 errors: 30 leads per day015314030Normal dayDay with 6h of 522 er…leads per day

Example: a site that normally gets 40 leads a day, on a day with a 6-hour origin error.

How to check if your site has it

Check for 52x errors
  1. Open the page in a private window

    Load your landing page, form page and checkout. A Cloudflare error page shows the code and a Ray ID.

  2. Test from the command line

    Run curl -I https://yourdomain.com/ and look at the status line. Repeat for the form and checkout URLs.

  3. Compare Cloudflare with the origin

    Request the origin directly, for example curl -I -k --resolve yourdomain.com:443:ORIGIN_IP https://yourdomain.com/. If this fails too, the fault is on the server.

  4. Check Cloudflare analytics

    In the Cloudflare dashboard, open Analytics and look at the 5xx error rate, grouped by status code, for the time of the problem.

  5. Read origin logs

    Check your web server error log and PHP or application log for crashes, timeouts and blocked requests at the same time.

Test the origin directly, bypassing Cloudflarebash
curl -I -k --resolve yourdomain.com:443:203.0.113.10 https://yourdomain.com/

How to fix it

Start with the code, because each one points to a different layer. Then use the platform notes if your host or builder limits what you can change.

Fix by error code
  1. 520: find why the origin returns nothing

    Check origin logs for crashes, PHP fatal errors, oversized response headers or a firewall resetting the connection. Fix the application error, then retest.

  2. 521 and 522: let Cloudflare reach the origin

    Make sure the server is running and listening on ports 80 and 443. Allow Cloudflare's published IP ranges in the server firewall, security plugin, and any host-level rate limiting. Reduce load if the server is overloaded.

  3. 523: correct the origin address

    In Cloudflare DNS, confirm the A or AAAA record for the proxied hostname points to the current origin IP. Update it after any host migration.

  4. 524: speed up the slow request

    Find the slow script, query or API call and optimise it. Move long jobs (imports, exports, reports) to background tasks so the request returns quickly.

  5. 525 and 526: repair origin SSL

    Install a valid certificate on the origin that covers the hostname and has not expired. A free Cloudflare Origin CA certificate works with Full (strict). Then set SSL/TLS mode to Full (strict) under SSL/TLS > Overview.

Platform notes
  1. Check PHP errors and plugins

    Turn on WP_DEBUG_LOG, read wp-content/debug.log, and disable recently updated plugins to find a crash (520) or slow request (524).

  2. Check security plugins

    In Wordfence or similar, make sure Cloudflare IPs are not rate limited or blocked (521, 522).

  3. Ask your host about SSL

    For 525 and 526, install or renew the certificate in your hosting control panel.

How to confirm it's fixed

Confirmation checklist
  • Landing page, form page and checkout return 200 through Cloudflare
  • The direct origin test also succeeds
  • Cloudflare analytics show the 5xx rate back to normal
  • A test form submission completes and the lead arrives
  • Checks from more than one region pass

How to prevent it happening again

Prevention checklist
  • Set certificate renewal to automatic and check expiry dates
  • Keep Cloudflare IP ranges allowed in every firewall layer
  • Update the origin IP in DNS whenever you change hosts
  • Watch server CPU, memory and database load
  • Test key journeys after every deploy or plugin update
  • Monitor the full journey on a schedule, not just the homepage

How FunnelGuard handles this

FunnelGuard detects this today. A robot visitor runs your real customer journeys on a schedule, from the EU or the US, and checks each step. If a page returns a Cloudflare 52x error instead of your site, the step fails. The failure is re-checked from a second region, then one alert goes out by email, Slack, Teams, WhatsApp, webhook or PagerDuty, with a screenshot and a likely cause. Frequency depends on your plan: the Free plan runs daily checks on 1 site and 2 journeys, and paid plans start with a 3-day free trial.

Questions people ask

What does Cloudflare error 520 mean?

Error 520 means the origin server sent an empty, unknown or invalid response to Cloudflare. Check your server error logs for crashes, PHP fatal errors, oversized headers or a firewall resetting the connection.

Why am I getting Cloudflare error 522 connection timed out?

Cloudflare could not open a connection to your origin in time. Usual causes are an overloaded server, a server that is offline, or a firewall that drops Cloudflare's IP addresses. Allow Cloudflare IP ranges and check server load.

How do I fix Cloudflare error 521 web server is down?

Confirm your web server is running and listening on ports 80 and 443. Then check that no firewall or security plugin blocks Cloudflare IPs, and that the origin IP in Cloudflare DNS is correct.

What causes Cloudflare error 524 a timeout occurred?

The origin accepted the connection but did not reply in time. This is usually a slow script, database query or external API call. Optimise it or move long tasks to the background.

How do I fix Cloudflare 525 and 526 SSL errors?

Install a valid, unexpired certificate on your origin that covers your hostname, then use SSL/TLS mode Full (strict). A Cloudflare Origin CA certificate is a free option for the origin link.

Is a Cloudflare 52x error my site's fault or Cloudflare's?

Usually the origin or its connection to Cloudflare. Test the origin directly with curl and --resolve. If it fails, the fault is on your server or host.

How can I know when my site shows Cloudflare errors?

Use monitoring that loads your real pages on a schedule. FunnelGuard runs your journeys from the EU or US, re-checks failures from a second region and sends one alert with a screenshot.

Does FunnelGuard catch this?

Detected

FunnelGuard checks for this today.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.