How to resolve the error 522 – Connection timed out

The Error 522: Connection timed out notice is a common server-side issue for Cloudflare enabled websites. We will look at what causes the 522 error and how to fix it, in this blog. As it is a server error, make sure you have server administrator access. The only other option to fix the issue is to contact the website owner. If you have access to the original server, keep reading to learn the three ways to resolve the problem.

We will go over how to troubleshoot these types of issues so that you don’t get any more Cloudflare errors.

522

Causes of Cloudflare Error 522

Firstly, we will discuss the causes of Cloudflare error 522. An HTTP status code of 522 indicates that a connection has timed out. Cloudflare is a content delivery network (CDN) service that improves and secures the network connection between a website user and the server at the hosting provider’s end. However, the server may occasionally fail to respond within the set timeframe. The host error 522 can easily be resolved by following the right method.

The TCP handshake between the web server and Cloudflare also fails as a result of this problem. Every time this CDN service receives a user request, a TCP handshake is required to establish a connection.

So, why isn’t the origin server responding in time? Some of the most typical causes of connection timeouts are

  1.     Server overload: This actually occurs when the initial server receives too many requests; it will not be able to react in a timely manner.
  2.     Cloudflare queries are blocked by the web host firewall. Some web hosting companies’ firewalls may restrict Cloudflare IP addresses, causing requests from the CDN to be flagged.
  3.     The IP address is incorrect. Your domain name system (DNS) addresses do not match the Cloudflare addresses.
  4.     KeepAlive is turned off. Default by Cloudflare turns on keepAlive messages. The connection setup will fail if they are disabled.

Any of these scenarios can lead to a 522 error on your website. The image and message will appear in most browsers, indicating that the issue is with the site host.

3 Easy steps to fix the error 522

We will explain how to check the particular reason for the ‘Connection Timed Out’ error as you go through each step to fix it.

1. Do check if the Web Server is working

A major cause of Cloudflare error 522 is that a web server is overburdened and cannot process HTTP requests. This is a common problem with shared hosting servers. Check if the origin web server is active and receiving HTTP requests to troubleshoot this error message. This can be one of the reasons for error 522 connection timed out.

The Packet Internet Groper (PING) program for Linux and Trace route for Windows are two options for checking your site’s origin web server. The PING command is used by both Linux and Windows users to check the status of your website’s server connectivity.

Another reason your origin server is down is that your website is receiving a lot of traffic. As a result, keep an eye on your order utilization to avoid exceeding any limits. This information will be accessed by a different hosting provider (host error 522).

Check the CPU utilization which should be below 80% to avoid bad performance, bandwidth, memory limit, and a total number of processes in the account.

2. Review Cloudflare DNS settings

When merging with a domain, Cloudflare will import all the DNS records. The Address Record (A Record) is one of the records that connect the domain to the IP address of the original web server. As a result, the error on post status code 522 or error 522 connection timed out message can be caused by an IP address mismatch. The A Records on the hosting server and Cloudflare must match to avoid this problem. Use the DNS Zone Editor and check the Address records. Access the DNS Zone Editor in hPanel and take note of the IP address under Content in DNS settings.

Change the Address records in Cloudflare’s DNS settings if they are different. Insert the IP address of the host server into the IPv4 address box by clicking the Add Record button. To save the changes done, click on the Save button.

This should resolve the 522 email error or 522 connection timed out the problem. It’s important to remember that DNS modifications can take up to 24 hours to propagate. Purging the Cloudflare cache, on the other hand, can speed up the process.

Cloudflare encryption modes are another DNS configuration. To double-check, we propose changing the encryption mode to full.

3. Look through other Web Server settings

Another option is to look into the server settings of the website. Take a look at these three in particular:

KeepAlive should be enabled

To keep established connections with the web server, Cloudflare uses the KeepAlive header entry. KeepAlive is a command that maintains a TCP connection open while sending HTTP requests. Connection failure is caused by disabling the KeepAlive message header in the initial web server. So, always make sure to enable the KeepAlive header to save CPU and memory on the server. Make sure you have access to one of the following files in order to use this method:

  1.     Htacces- hypertext access- is a configuration file for the Apache web server that allows you to add extra functionality to your website. This file can be found in the File Manager.
  2.     NGINX.conf is the open-source web server software’s main configuration.

A firewall feature that limits Cloudflare’s IP addresses is another cause of the http 522 error. To allow external requests from Cloudflare IPs, make sure to check the IP filtering on your host.

To control IP routing for your site, go to hPanel -> Other-> IP Manager. Under the Allow an IP Address area, select Cloudflare IPs and click Add.

These were some methods that can help you to solve the error 522 connection timed out.