Cloudflare 522: Origin Connection Timed Out

Symptom

Site behind Cloudflare intermittently returns 522.

Root cause

Cloudflare could not open a TCP connection to your origin within ~15s.

Fix, in order

1. Confirm the origin answers directlycurl -v http://YOUR-ORIGIN-IP/ -H "Host: yourdomain"
2. Check origin firewall allows Cloudflare IP rangeshttps://www.cloudflare.com/ips/
3. Check listening port matches DNS record (80/443)ss -tlnp | grep -E ":80|:443"

Prevent it coming back

Monitor origin reachability from outside your network; alert on first 522.

Deep-dive article

Full walkthrough: Cloudflare 522: Origin Connection Timed Out on the NinjaOps blog.

Run it on clean infra

Spinning up a fresh box to reproduce or escape this error?

Managed cloud hosting

Related

Cloud & DevOps tool comparisons · Hardware build guides

NinjaOps publishes free engineering guides. Some outbound links are affiliate links: they cost you nothing and support the site.

Last reviewed 2026-10-02 · NinjaOps SEO grid · DevOps blog