Question

Cloudflare 520 vs 524: how to tell quickly

Teams often mix up these two and run the wrong checks. Use this quick split before changing infra settings.

One-line difference

Fast diagnosis matrix

Command sequence

# Proxied response
time curl -sv https://yourdomain.com/your-endpoint -o /dev/null

# Direct origin response
time curl -sv --resolve yourdomain.com:443:ORIGIN_IP https://yourdomain.com/your-endpoint -o /dev/null

# Header and runtime logs
curl -sI --resolve yourdomain.com:443:ORIGIN_IP https://yourdomain.com/your-endpoint
sudo journalctl -u caddy --since '30 minutes ago' --no-pager | tail -n 120
sudo journalctl -u nginx --since '30 minutes ago' --no-pager | tail -n 120

What to fix first

  1. If 520 pattern: fix invalid headers, cookie bloat, and reset-prone upstream behavior.
  2. If 524 pattern: reduce synchronous workload and optimize slow endpoints.
  3. Re-test through Cloudflare for 30-60 minutes before broader changes.

Need full runbooks? Open 520 troubleshooting and 524 troubleshooting.

Generate Cloudflare 52x checklist