Webservers come with all sorts of errors. From a missing file to a broken link, anything can give rise to a boatload of confusing error codes that are pretty simple to fix for those who know what they’re doing.
In this article, we’re going over the error 522: connection timed out the issue and how you can resolve the situation.
What causes Error 522
The error is most likely caused when a client is trying to reach a web server, and the server doesn’t respond or acknowledge the requests in time. If you’re going through a DDoS protection service like Cloudflare, the error can be caused by two different timeouts.
- Before a connection is established, the web server doesn’t return a SYN+ACK to Cloudflare within 15 seconds of sending a SYN.
- After a connection is established, the web server doesn’t respond to or acknowledge the client’s request within 90 seconds.
How to fix this issue?
Here are a few things you can try out to fix the problem.
Check if the web server is offline
If a server is offline, it’ll obviously not reply to any connection requests you send it, resulting in this issue. Check to see if your server is up and running and that it’s connected to the internet.
There’s a server overload
If a given server is overloaded with incoming requests, it’ll start queuing any additional requests and hence the later your request in the queue, the more likely you are to get a 522 error. In such cases, it’s best to try again after some time or in the off hours when the server might not be as busy.
If a firewall protects the target or origin web server, chances are the firewall may accidentally block your IP resulting in your web requests not reaching the server at all. This creates similar conditions to the two situations described above and can cause a timeout error.
Incorrect DNS settings
DNS settings are directly responsible for redirecting a URL to a destination server with a particular IP address. If the server DNS settings are misconfigured, users entering a particular URL can be misdirected or even get a request timeout error.
Check to ensure your DNS settings are in conjunction with your server’s IP address and that users are redirected to the correct destination IP.
IP routing takes place mostly between Cloudflare and the webserver. If these routing settings are misconfigured, communication between Cloudflare and the server will be impacted, resulting in Cloudfare not routing IPs back to the server.
Check to see if your routing settings are in place and that the communication between Cloudflare and your server is working fine.
Keepalive messages are disabled
Cloudflare uses a header entry called ‘keepalive’, which maintains established connections with the web server over extended periods. If keepalive messages are disabled on the server, the connection setup fails to result in a 522 error.
Check to make sure keepalive message requests are enabled on the server and that the Cloudflare and server connection is set up properly.