| Status code | 522 |
|---|---|
| Status text | Connection Timed Out |
| Category | 5xx Server Error |
| Response has body | Usually |
| Defined by | Cloudflare (not an IANA-registered code) |
What does 522 Connection Timed Out mean?
Cloudflare tried to open a TCP connection to the origin server and got no answer in time. It is numbered in the 5xx Server Error range but is not a registered HTTP status code, so the general meaning of that class is only a rough guide to it.
When do APIs return 522?
On sites behind Cloudflare, when connection attempts to the origin go unanswered. Unlike 521, nothing refused the connection; the packets simply got no reply. That points to a firewall silently dropping them, an origin too overloaded to accept connections, or a DNS record at Cloudflare pointing to the wrong IP address.
How to fix a 522 Connection Timed Out
Check that the origin IP address in the Cloudflare DNS settings is current. Make sure the origin firewall allows Cloudflare's IP ranges, and that the server is not out of capacity: a saturated server stops accepting new connections. If keep-alive is disabled at the origin, enabling it reduces the number of connections it has to accept.
Reproduce a 522 response
The fastest way to understand a status code is to trigger one and read the full response. Open the
API tester and send a request to https://httpbin.org/status/522 — you will
see the 522 status along with every response header the server sent. Comparing those headers against
a working request is often what reveals the cause.
That response only imitates the number, which is useful for checking how your own client, alerting or retry logic treats a 522. A real one comes from the software named in the table above, in the circumstances this page describes.
When you are debugging a real endpoint, check the response headers as carefully as the body, and confirm you are using the right HTTP method for the operation.
Related 5xx status codes
500 Internal Server Error
The server hit an unexpected condition and could not complete the request.
501 Not Implemented
The server does not support the functionality required to fulfil the request.
502 Bad Gateway
A server acting as a gateway or proxy received an invalid response from the upstream server.
503 Service Unavailable
The server is temporarily unable to handle the request.
504 Gateway Timeout
A gateway or proxy did not receive a timely response from the upstream server.
505 HTTP Version Not Supported
The server does not support the major HTTP version named in the request.
522 Connection Timed Out FAQ
What is the difference between Cloudflare 521 and 522?
521 means the origin server actively refused the connection, so something answered and said no. 522 means the connection attempt got no answer at all before the time limit, which usually points to a firewall dropping packets or an overloaded server.
Is a 522 error a problem with my browser or internet connection?
No. The page was generated by Cloudflare, which means your request reached Cloudflare without trouble. The failure is between Cloudflare and the website's own server, and only the site's owner can fix it.
What is the difference between 522 and 524?
With 522 Cloudflare could not establish a connection to the origin. With 524 the connection was established and the origin then took too long to send its response.
See also
- 521 Web Server Is Down — Cloudflare tried to connect to the origin server and the connection was refused.
- 524 A Timeout Occurred — Cloudflare connected to the origin server, but the origin took too long to send a response.
- 504 Gateway Timeout — A gateway or proxy did not receive a timely response from the upstream server.
- DNS lookup — Check which address the origin host name really points to.
References
- Cloudflare Docs: Error 522 — Cloudflare's own description of the cause and the checks to run.
- IANA: HTTP Status Code Registry — The official list of registered codes. This one is not on it.