Skip to content

HTTP Status Code 522 – Connection Timed Out

HTTP Status Code 522 – Connection Timed Out

The HTTP status code 522 indicates that a connection to the origin web server timed out. This error is specific to Cloudflare, a content delivery network (CDN) and web security provider. When Cloudflare attempts to connect to the origin server to fulfill a user’s request, and the server does not respond in a timely manner, a 522 error occurs. This typically suggests network connectivity issues between Cloudflare and the origin server.

Example 1: Server Not Responding

Consider a scenario where a user is trying to access a website that is served through Cloudflare. The origin server hosting the website is down or not configured to respond to requests. In this case, Cloudflare will attempt to establish a connection but will fail due to the server’s non-responsiveness, resulting in a 522 error.

GET /index.html HTTP/1.1
Host: www.example.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36

HTTP/1.1 522 Connection Timed Out
Content-Type: text/html
Content-Length: 160
Connection: keep-alive

<html>
<head><title>522 Connection Timed Out</title></head>
<body><h1>Connection Timed Out</h1><p>The origin server did not respond within the timeout period.</p></body>
</html>

Example 2: Network Configuration Issues

Another common cause of a 522 error is improper network configurations, such as a firewall blocking requests to the origin server or routing issues. In the following scenario, the origin server is up and running, but a misconfigured firewall is blocking Cloudflare’s IP addresses, preventing them from reaching the server.


GET /api/data HTTP/1.1
Host: api.example.com
User-Agent: curl/7.68.0 HTTP/1.1 522 Connection Timed Out Content-Type: text/html Content-Length: 150 Connection: keep-alive <html> <head><title>522 Connection Timed Out</title></head> <body><h1>Connection Timed Out</h1><p>Network issues prevented Cloudflare from reaching the server.</p></body> </html>

Example 3 Scenario

# Client sends a request example.
GET /example HTTP/1.1
Host: www.example.com

# Server Response
HTTP/1.1 522 522 Connection Timed Out
Date: Wed, 09 Oct 2024 23:13:18 GMT
Server: ExampleServer/1.0
Content-Type: application/json

{
    "error": "Description of the error for 522"
}

Example 4 Scenario

# Client sends another example request.
POST /another-example HTTP/1.1
Host: www.example.com

# Server Response
HTTP/1.1 522 522 Connection Timed Out
Date: Wed, 09 Oct 2024 23:13:18 GMT
Server: ExampleServer/1.0
Content-Type: application/json

{
    "error": "Detailed message for 522"
}

Summary

The HTTP 522 status code signifies a connection timeout between Cloudflare and the origin server. Common causes include server downtime, network configuration errors, or other connectivity problems. When troubleshooting, ensure that the origin server is operational, network settings are correctly configured, and that there are no firewall rules blocking Cloudflare’s requests.

I am the founder of SEO Leaders and have been involved in the internet and web development in one way or another for over 20 years. Since founding SEO Leaders some 6 years ago I have been heavily involved in web develepment, Digital PR and technical SEO for a wide variety of projects. I hope to enlighten you on a wide range of topics related to my chosen profession!

Back To Top