cf-ray response header and the specific 52x error code.
What cf-ray actually tells you
cf-ray header. It looks something like 8f3a2b1c0d4e5f6a-SIN. The first part is a hex request ID unique to that request. The three-letter suffix is the IATA airport code of the Cloudflare data center (edge node) that handled the request. SIN means Singapore, LAX means Los Angeles, CGK means Jakarta, and so on.
This header matters during an incident for two reasons:
- The data center code tells you which edge location processed your request. If Cloudflare has a localized outage affecting one data center, you can confirm whether your traffic is hitting that specific location.
- The ray ID is what Cloudflare support needs to trace a specific failed request through their internal logs. Without it, they cannot investigate.
BASH
curl -sI https://your-domain.com | grep -i 'cf-ray\\|HTTP/'TEXT
HTTP/2 520
cf-ray: 8f3a2b1c0d4e5f6a-SINWhat each 52x code points to
| Code | Name | What typically broke |
|---|---|---|
| 520 | Web Server Returns an Unknown Error | Origin sent an empty, malformed, or oversized response that Cloudflare could not parse |
| 521 | Web Server Is Down | Origin refused the TCP connection entirely (web server process stopped, or firewall blocking Cloudflare IPs) |
| 522 | Connection Timed Out | TCP handshake between Cloudflare edge and origin never completed (network issue or origin overloaded) |
| 523 | Origin Is Unreachable | DNS for the origin resolved but no route to host (origin IP unreachable) |
| 524 | A Timeout Occurred | TCP connected fine, but origin did not send an HTTP response within the timeout window |
| 525 | SSL Handshake Failed | TLS handshake between Cloudflare edge and origin failed (expired cert, mismatched SNI, wrong SSL mode) |
| 526 | Invalid SSL Certificate | Origin presented a certificate Cloudflare could not validate (self-signed cert with Full Strict mode) |
cf-ray and cf-cache-status headers when you get a 503 but your origin seems healthy, see Cloudflare 503 but Origin Is Healthy? Read cf-ray and cf-cache-status Headers to Find the Fault.
Verify from your origin's access logs
/var/log/apache2/access.log. On CentOS/RHEL it is typically /var/log/httpd/access_log. Nginx usually logs to /var/log/nginx/access.log. These paths vary depending on your configuration, so check your virtual host or server block config if the defaults do not exist.
Search for requests around the time of the error:
BASH
# Check last 50 lines of access log for recent requests
tail -50 /var/log/nginx/access.log- No matching request in the log at all: Origin never received the request. Points to 521 (connection refused), 522 (TCP timeout), or 523 (unreachable). Your web server process might be down, or a firewall is dropping connections from Cloudflare's IP ranges.
- Request present but with a 5xx status: Origin received the request and returned an error. Points to 520 (if the response was malformed or empty) or 524 (if the origin took too long and Cloudflare gave up waiting).
- Request present with a 200 status: Origin thinks it responded fine. This can still cause a 520 if the response headers were malformed, oversized, or if the connection was reset mid-transfer.
Check if your firewall blocks Cloudflare
iptables:
BASH
# List current firewall rules (read-only, safe to run)
iptables -L -n | head -40https://www.cloudflare.com/ips/. If you maintain an allowlist, pull the latest ranges from that page rather than hardcoding them, because Cloudflare adds new ranges periodically.
Also verify your web server process is actually running and listening on the expected port:
BASH
ss -tlnp | grep -E ':80|:443'Distinguish edge failure from origin failure during a real outage
- Grab the cf-ray header from the error response. If you get a cf-ray header at all, Cloudflare's edge is responding. The edge is alive.
- Note the data center code in cf-ray. Check Cloudflare's status page for incidents affecting that specific data center.
- Check the specific 52x code. A 521 or 522 strongly suggests your origin is unreachable. A 525 or 526 points to an SSL/TLS configuration mismatch between Cloudflare and your origin.
- Check your origin access logs. If the request never arrived at your origin, the break is in the network path between Cloudflare's edge and your server. If the request arrived and your origin returned an error or timed out, the problem is on your side.
- Test origin directly. If your origin has a public IP you can reach without going through Cloudflare, curl it directly to see if it responds. This bypasses Cloudflare entirely and tells you whether the origin is fundamentally healthy.
When to escalate to Cloudflare vs. fix it yourself
- Your origin responds correctly to direct requests (bypassing Cloudflare), but requests through Cloudflare still fail.
- The cf-ray data center code matches a location listed on Cloudflare's status page as having issues.
- You see 52x errors from multiple unrelated origins behind Cloudflare simultaneously, suggesting an edge-side problem rather than a single origin failure.
