HTTP 522 · 5XX Cloudflare Edge Cacheable: No Retryable: Yes (with backoff)

HTTP 522 Connection Timed Out: Root Causes & Production Fix Guide

Cloudflare Error 522 occurs when Cloudflare attempts to open a TCP connection to your origin server and receives no ACK before the 15-second handshake timeout (or 90-second read timeout).

Top Root Causes of HTTP 522

Check Origin Connectivity & Kernel TCP Backlog

# 1. Confirm Cloudflare DNS A record matches your live server IP
# 2. Ensure Nginx keepalive is enabled for Cloudflare edge reuse:
http {
    keepalive_timeout 65;
    keepalive_requests 1000;
}
# 3. Verify AWS Security Group / Firewall allows inbound TCP 443 from Cloudflare IPs.

Verify with cURL

curl -v --connect-timeout 10 --resolve example.com:443:ORIGIN_IP https://example.com/

Interactive Stack Diagnoser (HTTP 522)

Frequently Asked Questions

Why does Cloudflare 522 happen intermittently?

Intermittent 522s are usually caused by origin resource exhaustion (CPU/RAM/PHP-FPM workers maxed out), packet loss between edge and origin, or rate-limiting firewalls dropping bursts.

Does Cloudflare require Keep-Alive on the origin?

Yes. Disabling HTTP keep-alive forces a fresh TCP/TLS handshake on every request and significantly increases 522 timeout risk.

How do I fix 522 on AWS EC2?

Add inbound rules for TCP 443 (and 80 if needed) from Cloudflare's official IPv4/IPv6 CIDR list in your EC2 Security Group and verify Network ACLs allow ephemeral return ports.

Related Status Guides & Header Tools