522 Connection Timed Out
A Cloudflare-specific code: the origin did not complete the TCP handshake within the allowed time.
Cloudflare timed out trying to establish a TCP connection to the origin.
What HTTP 522 Connection Timed Out Means
Cloudflare timed out trying to establish a TCP connection to the origin.
A Cloudflare-specific code: the origin did not complete the TCP handshake within the allowed time.
Common Causes
- Origin overloaded or too slow to accept connections
- Firewall dropping (not rejecting) Cloudflare traffic
- Network routing issues between Cloudflare and origin
- Origin keepalive settings too low
How to Fix It (For Visitors)
- Refresh the page after a minute
- Contact the website owner
How to Fix It (For Developers/Admins)
- Allow Cloudflare IPs and stop dropping packets
- Reduce origin load / scale up
- Increase keepalive timeout on the origin
- Check routing and MTU between Cloudflare and origin
Returning a 522 Connection Timed Out (Code Examples)
If you build APIs or web apps, here is how to send an HTTP 522 response and how to test for it:
Node.js (Express)
app.get('/resource', (req, res) => {
res.status(522).json({ error: 'Connection Timed Out' });
});
Python (Flask)
@app.route('/resource')
def resource():
return jsonify(error='Connection Timed Out'), 522
PHP
<?php
http_response_code(522);
header('Content-Type: application/json');
echo json_encode(['error' => 'Connection Timed Out']);
Check the status with curl
curl -I https://example.com/resource
# Look for: HTTP/1.1 522 Connection Timed Out
Frequently Asked Questions
What does HTTP 522 Connection Timed Out mean?
A Cloudflare-specific code: the origin did not complete the TCP handshake within the allowed time. In short: Cloudflare timed out trying to establish a TCP connection to the origin.
Is a 522 Connection Timed Out error my fault or the website's?
522 is a 5xx server-error code, so the problem is on the server side, not your browser or device. As a visitor you can usually only retry; if you run the site, investigate the server.
How do I fix a 522 Connection Timed Out error?
Allow Cloudflare IPs and stop dropping packets. Reduce origin load / scale up. Increase keepalive timeout on the origin.
Official Specification
The 522 Connection Timed Out status code is defined in Cloudflare (non-standard).