How do I pinpoint the cause of Cloudflare 520?
Use `curl --resolve yourdomain.com:443:ORIGIN_IP https://yourdomain.com/` to test the origin directly and check origin error logs at the exact timestamp of the Cloudflare Ray ID.
Cloudflare Error 520 is a catch-all edge error triggered when your origin web server returns an empty response, resets the TCP connection unexpectedly, or sends invalid/oversized (>16KB) HTTP response headers.
# 1. Hit origin IP directly with Host header to inspect raw response:
curl -i -sS --resolve example.com:443:ORIGIN_IP https://example.com/
# 2. In Nginx, keep response headers compact and disable debug leaks:
server_tokens off;
fastcgi_hide_header X-Powered-By;
proxy_hide_header X-Powered-By;
curl -i -sS --resolve example.com:443:203.0.113.10 https://example.com/
Use `curl --resolve yourdomain.com:443:ORIGIN_IP https://yourdomain.com/` to test the origin directly and check origin error logs at the exact timestamp of the Cloudflare Ray ID.
Yes. If your origin emits response headers exceeding Cloudflare's 16KB header limit (e.g., dozens of `Set-Cookie` headers), Cloudflare aborts with 520.
Checking SSL/TLS Full (Strict) and ensuring clean HTTP/1.1 or HTTP/2 framing on Nginx/Caddy eliminates most malformed-response 520s.