# How to Tell Cloudflare Error 521 From Error 522

https://ferkesh.net/uk/baza-znan/stattia/cloudflare-521-versus-522-origin

![Workflow: Capture context; Compare refusal and timeout; Check approved access; Confirm recovery.](https://ferkesh.net/kb-media/ferkesh-guide-diagrams-batch-14.svg#cloudflare-521-versus-522-origin)

Cloudflare’s 521 and 522 suggest different connection failure patterns. Keep the exact code as the starting point and verify which backend was expected to answer.

## Procedure

1. **Capture context.** Record the affected hostname, error, time and Ray ID. Check whether all hostnames or just one origin behind a pool are affected.
2. **Compare refusal and timeout.** For 521, inspect whether the intended service is running and accepting that connection. For 522, review connectivity, load and timing with the host for the authorized route.
3. **Check approved access.** Review the scoped firewall and proxy allowlist against the provider’s documented requirements. Change only the agreed listener or rule when the evidence identifies the blocking layer.
4. **Confirm recovery.** Retest the same public route and representative backends. Compare response timing and logs, and include the Ray ID when escalating a repeatable failure.

## Related guides

- [How to Troubleshoot 502, 503 and 504 Website Errors](https://ferkesh.net/knowledgebase/article/gateway-errors-502-503-504)
- [How to Diagnose Cloudflare Error 1016](https://ferkesh.net/knowledgebase/article/cloudflare-origin-dns-1016)
- [Website Troubleshooting articles](https://ferkesh.net/knowledgebase/category/website-troubleshooting)

## Official references

- [Cloudflare Error 521](https://developers.cloudflare.com/support/troubleshooting/http-status-codes/cloudflare-5xx-errors/error-521/)
- [Cloudflare Error 522](https://developers.cloudflare.com/support/troubleshooting/http-status-codes/cloudflare-5xx-errors/error-522/)

Ferkesh Hosting. Last reviewed November 26, 2026.
