Debug Your Cloudflare Error With the Ray ID

Find the Ray ID on your Cloudflare 520 through 527 error page, then use it to trace exactly what your origin server did wrong and how that differs from a standard 502 or 504.

ZERO UPLOAD · ALL LOCAL
  1. Type a code number (e.g. 404) to find codes by number only, or a word (e.g. "timeout", "rate limit") to search names and detail content.
  2. Use the category pills (1xx–5xx) to browse codes by class when not searching.
  3. Click Details on any card to expand causes and resolution steps in a full-width panel below the row.
  4. Click Copy Markdown on an expanded card to copy a ready-to-paste summary for Jira tickets, GitHub issues, or Slack.

Cloudflare 52x codes

  • 520 Unknown Error origin returned something that doesn't conform to HTTP
  • 521 Web Server Is Down origin actively refused the TCP connection
  • 522 Connection Timed Out TCP connection to the origin timed out
  • 524 A Timeout Occurred origin accepted the connection but didn't respond in time
  • 526 Invalid SSL Certificate origin's SSL certificate is invalid, expired, or untrusted

1XX INFORMATIONAL — 4 codes

100 Continue
RFC 9110
101 Switching Protocols
RFC 9110
102 Processing
RFC 2518
103 Early Hints
RFC 8297

2XX SUCCESS — 10 codes

200 OK
RFC 9110
201 Created
RFC 9110
202 Accepted
RFC 9110
203 Non-Authoritative Information
RFC 9110
204 No Content
RFC 9110
205 Reset Content
RFC 9110
206 Partial Content
RFC 9110
207 Multi-Status
RFC 4918
208 Already Reported
RFC 5842
226 IM Used
RFC 3229

3XX REDIRECTION — 8 codes

300 Multiple Choices
RFC 9110
301 Moved Permanently
RFC 9110
302 Found
RFC 9110
303 See Other
RFC 9110
304 Not Modified
RFC 9110
305 Use Proxy
RFC 9110
307 Temporary Redirect
RFC 9110
308 Permanent Redirect
RFC 9110

4XX CLIENT ERROR — 35 codes

400 Bad Request
RFC 9110
401 Unauthorized
RFC 9110
402 Payment Required
RFC 9110
403 Forbidden
RFC 9110
404 Not Found
RFC 9110
405 Method Not Allowed
RFC 9110
406 Not Acceptable
RFC 9110
407 Proxy Authentication Required
RFC 9110
408 Request Timeout
RFC 9110
409 Conflict
RFC 9110
410 Gone
RFC 9110
411 Length Required
RFC 9110
412 Precondition Failed
RFC 9110
413 Content Too Large
RFC 9110
414 URI Too Long
RFC 9110
415 Unsupported Media Type
RFC 9110
416 Range Not Satisfiable
RFC 9110
417 Expectation Failed
RFC 9110
418 I'm a Teapot (Unofficial)
RFC 2324
420 Enhance Your Calm (Unofficial)
Twitter
421 Misdirected Request
RFC 9110
422 Unprocessable Content
RFC 9110
423 Locked
RFC 4918
424 Failed Dependency
RFC 4918
425 Too Early
RFC 8470
426 Upgrade Required
RFC 9110
428 Precondition Required
RFC 6585
429 Too Many Requests
RFC 6585
431 Request Header Fields Too Large
RFC 6585
444 No Response (Unofficial)
nginx
451 Unavailable For Legal Reasons
RFC 7725
494 Request Header Too Large (Unofficial)
nginx
495 SSL Certificate Error (Unofficial)
nginx
496 SSL Certificate Required (Unofficial)
nginx
499 Client Closed Request (Unofficial)
nginx

5XX SERVER ERROR — 19 codes

500 Internal Server Error
RFC 9110
501 Not Implemented
RFC 9110
502 Bad Gateway
RFC 9110
503 Service Unavailable
RFC 9110
504 Gateway Timeout
RFC 9110
505 HTTP Version Not Supported
RFC 9110
506 Variant Also Negotiates
RFC 2295
507 Insufficient Storage
RFC 4918
508 Loop Detected
RFC 5842
510 Not Extended
RFC 2774
511 Network Authentication Required
RFC 6585
520 Web Server Returns an Unknown Error (Unofficial)
Cloudflare
521 Web Server Is Down (Unofficial)
Cloudflare
522 Connection Timed Out (Unofficial)
Cloudflare
523 Origin Is Unreachable (Unofficial)
Cloudflare
524 A Timeout Occurred (Unofficial)
Cloudflare
525 SSL Handshake Failed (Unofficial)
Cloudflare
526 Invalid SSL Certificate (Unofficial)
Cloudflare
527 Railgun Listener to Origin Error (Unofficial)
Cloudflare
No codes match your search.

Debug Your Cloudflare 52x Error With the Ray ID

Find the Ray ID on your Cloudflare error page first: it is your primary debugging artifact for any code above 520. These codes are not part of the IANA HTTP status registry; they are vendor extensions that Cloudflare generates at its edge when the connection between Cloudflare and the origin server fails in a specific way.1 Seeing a 52x error means Cloudflare received the request successfully but could not successfully retrieve a response from your origin.

Consequently, the problem is never on the client side and never inside Cloudflare's own network: it is always between Cloudflare and your origin server. Matching your specific 52x code to its failure mode, using the Ray ID from your error page, points debugging directly at the correct origin-side fix.2

Reading Cloudflare error pages vs origin errors

Cloudflare error pages differ visually from origin error pages in several diagnostic ways: they display a "Cloudflare" branding bar at the top, an error number (520, 521, etc.) in the page title, and a Ray ID in the bottom-right corner that uniquely identifies the failing request. An origin error page, by contrast, is served directly from your application without Cloudflare branding and typically does not include the Ray ID, which makes correlating the error with Cloudflare's edge logs significantly harder.

When you see a 52x code, the error page was generated by Cloudflare, not your application. The root cause always lies in the connection or response between Cloudflare and your origin. Each 52x code represents a different failure mode: 520 means the origin returned an unknown or invalid response; 521 means the origin actively refused the connection; 522 means the TCP connection to the origin timed out; 524 means the origin accepted the connection but did not respond in time.1

The Ray ID on the error page is your primary debugging artifact: log it, search for it in Cloudflare's logs or your origin access logs, and correlate it to the exact request. Without the Ray ID, you are left comparing timestamps and request paths across two separate log systems, which is slow and error-prone during an incident that demands a rapid resolution.2

52x codes vs standard 502 and 504

Cloudflare's 52x codes replace the standard 502 Bad Gateway and 504 Gateway Timeout that a generic reverse proxy would produce. Cloudflare generates 52x codes specifically so that Cloudflare-proxied infrastructure can distinguish between failures at the Cloudflare edge and failures between Cloudflare and your origin. This distinction matters because the remediation path is completely different: an edge failure requires Cloudflare support, while an origin failure requires your own infrastructure team to investigate.

52x to standard code mapping

A 520 Unknown Error is the broadest category: the origin returned something that does not conform to HTTP. A 521 Web Server Is Down maps roughly to a TCP connection refused error. A 522 Connection Timed Out maps roughly to a TCP connection timeout. A 524 A Timeout Occurred maps roughly to an HTTP read timeout after the connection was established.

526 Invalid SSL Certificate and 527 Railgun Listener to Origin Error are specific to Cloudflare's SSL validation and the deprecated Railgun product respectively. Knowing this mapping helps bridge the gap between Cloudflare-specific documentation and standard HTTP debugging knowledge. For most debugging scenarios, focus on 520 through 524 first: these five codes cover the overwhelming majority of origin connectivity issues and each points to a distinct failure mode that maps to a specific fix on your origin server.

Debugging with the Cloudflare Ray ID

Every request Cloudflare processes receives a unique Ray ID, which appears in the error page HTML and in the CF-Ray response header. Using this ID in Cloudflare's dashboard, you can find the specific request in the Cloudflare Logs or Logpush stream and see the exact error message, origin IP address, and connection details. Treat the Ray ID as the single source of truth during an incident: it lets you confirm whether Cloudflare saw the request, whether the origin responded at all, and what specific error the edge encountered when forwarding the connection.

Correlating Ray IDs across log systems

Configure Cloudflare Logpush to stream logs to your storage or SIEM so that Ray IDs are searchable without accessing the Cloudflare dashboard manually. On the origin server, log the CF-Connecting-IP and CF-Ray headers on every incoming request: this links your origin access log entry to the Cloudflare log entry for the same request. Without this correlation, you can see that Cloudflare rejected a request but cannot determine what the origin actually sent, which turns every 52x investigation into a guessing game.

When a 52x error is reported with a Ray ID, you can correlate the Cloudflare edge log with the origin access log to determine exactly what the origin returned and why Cloudflare rejected it. tracing a Cloudflare Ray ID back to the origin response is the fastest way to confirm whether the failure is a connection timeout, an invalid response, or an SSL mismatch at the edge. This cross-system correlation is the fastest path to root cause: it tells you whether the origin sent an invalid response, timed out entirely, or refused the connection, without requiring you to reproduce the issue from outside the Cloudflare network.

Cloudflare Always Online and origin connectivity issues

Cloudflare's Always Online feature serves cached versions of your pages when Cloudflare cannot reach your origin server. When a 52x error occurs because the origin is completely unreachable, Always Online checks Cloudflare's cache and serves the last known good version of the page with a banner indicating the site is temporarily offline. This feature activates for 502, 504, and Cloudflare-generated 52x status codes (520-527) when the origin is unreachable.3

Always Online has important limitations you must understand before relying on it. Pages that require authentication, pages with forms that submit to the origin, and pages generated from real-time data are served from cache in a broken state: the cached version exists, but any user action that reaches the origin will fail. Always Online is designed for informational pages, not for application workflows. Disable it for routes that must show a genuine error when the origin is down, rather than a stale cached version.

Verifying Always Online cache coverage

Cloudflare caches pages for Always Online based on your Cache-Control headers and Cloudflare's caching tier. Pages without any Cache-Control headers, or with Cache-Control: no-store, are not eligible for Always Online. Check which pages Cloudflare has cached by reviewing the cache hit rate for your domain in Cloudflare Analytics. For high-traffic public pages, set Cache-Control: public, max-age=3600 to ensure Cloudflare has a cached copy available for Always Online to serve when the origin becomes unreachable.4

When to use this

Grab the Ray ID from your error page and use this guide when diagnosing errors on Cloudflare-proxied infrastructure. Match your specific 52x code to understand what it means about the origin-to-Cloudflare connection, and determine which logs to inspect next.

Examples

521 Web Server Is Down appears after deployment

The origin is not listening on the expected port (80 or 443). Check that the application process started successfully and is bound to the correct port. Verify Cloudflare is pointing to the correct origin IP address.

522 Connection Timed Out appearing intermittently

Cloudflare could not establish a TCP connection to the origin within 15 seconds. Check origin server firewall rules: Cloudflare IP ranges must be allowed. Also check if the origin is under high load causing connection queue buildup.

526 Invalid SSL Certificate

The SSL certificate on the origin server is invalid, expired, or untrusted by Cloudflare. Either install a valid CA-signed certificate on the origin, or change the Cloudflare SSL mode to "Flexible" (not recommended for production) or "Full" (accepts self-signed certs from origin).

Sources
  1. 1.

    Cloudflare, "Cloudflare 5xx errors," developers.cloudflare.com, accessed June 2026. https://developers.cloudflare.com/support/troubleshooting/http-status-codes/cloudflare-5xx-errors/

  2. 2.

    Stack Overflow, "What is a Ray ID (Cloudflare)?," stackoverflow.com, accessed June 2026. https://stackoverflow.com/questions/49968948/what-is-a-ray-id-cloudflare

  3. 3.

    Cloudflare, "Always Online because downtime sucks," blog.cloudflare.com, accessed June 2026. https://blog.cloudflare.com/always-online-because-downtime-sucks/

  4. 4.

    Mozilla Developer Network, "Cache-Control," developer.mozilla.org, accessed June 2026. https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Cache-Control

FAQ