Bobcares

Here’s how to fix – Cloudflare error 524

by | Oct 18, 2019

Cloudflare is a very popular CDN that facilitates faster loading of websites. But if not configured right, the website can end up showing Cloudflare related errors.

One such issue is Cloudflare error 524. This is mainly caused due to long-running processes on the server, due to which Cloudflare fails to complete the connection.

At Bobcares, we resolve different types of website errors, which includes Cloudflare errors as well, as a part of our Server Management Services.

Today, let’s see what causes this 524 error and how our Support Engineers fix it.

 

Why Cloudflare error 524 show up?

Cloudflare has set a timeout of maximum 100 seconds for non-Enterprise users. For Enterprise users, this value can be increased up to a limit of 600 seconds.

Cloudflare normally creates a TCP connection to the origin server, and it waits for this timeout period of 100 seconds, for the origin server to respond.

If there is no response sent by the origin server within this time, then Cloudflare will close the connection and will throw an error 524 in the web page.

 

How we fix Cloudflare error 524?

The 524 error is usually caused due to long-running processes on the server. It includes PHP, web server or database processes.

Recently, one of our customers approached us with the error Cloudflare Error 524: A timeout occurred.

Let’s now see how our Support Engineers fixed this error.

 

1. Check the load on the server

The load on the server is the main cause for this error to occur. So our Support Engineers started to troubleshoot this error by checking the load on the server using the command

top -c

There were too many PHP processes running on the server. So we killed all those processes from the server.

Also, there were too many sleep connections in MySQL. So, we started checking the processes in the MySQL.

We used the command mysql to get into the MySQL command prompt and executed the below command to check the MySQL processes:

show full processlist;

This provided the list of all processes related to MySQL. Later, we killed all those processes as well.

But killing the processes or restarting the service was only a temporary fix. To prevent the recurrence of the error, we dug deeper and performed tweaks in the culprit service.

 

2. Check the hits on port 80

Too many website hits from a particular IP can also cause a tremendous effect on the server and its load. This could be due to any attacks or improperly coded scripts.

So we checked if there were too many hits from any particular IP. We used the below command to check the IP hits for the website.

netstat -an | grep 80

This command will provide the list of the IPs from which the website is receiving too many hits. We decided to review this list and block any suspicious or unwanted IP addresses.

So we blocked few IPs using the command

iptables -A INPUT -s xxx.xx.xx.x -j DROP

At last, we restarted the Apache using the command

systemctl httpd restart

This helped to lower the website hits and also the load on the server. This also ensured that only valid traffic is served by the origin server.

Finally, Cloudflare was able to make a connection with the server, and loaded the website instead of Cloudflare error 524. We also configured a firewall in the server to avoid such issues from happening again.

[Need any further assistance with Cloudflare error? – We’ll help you]

 

Conclusion

In short, the Cloudflare error 524 is caused mainly due to long-running processes on the server or too many website hits. Today, we saw how our Support Engineers fix this error.

3 Comments

  1. Nani

    Hi, as a website developer, how can we solve this or another way as a backup plan if this case happening again?

    Reply
    • Sijin George

      Hello Nani,
      Apologize for the delay in reply. 524 errors can be related to host server settings. If you need further assistance, we’ll be happy to talk to you on chat (click on the icon at right-bottom).

      Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.