How to Fix Cloudflare Error 524: A Timeout Error Occurred

When Cloudflare is able to successfully connect to a web server but it doesn’t receive any HTTP response after a while, you’ll see the pesky Error 524: A Timeout Error Occurred:

Cloudflare Error 524

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

Once the connection is established, Cloudflare starts transferring data with the help of the HTTP protocol.

In a rush? Click here to get to the fixes and skip the tech mumbo-jumbo 😉

What is Cloudflare Error 524: A Timeout Error Occurred?

While an erroneous connection will throw a more detailed error code for the given problem (like error 520 or error 521), if no connection is ever established at all you’ll see Error 524: A Timeout Occurred. The 524 error usually signals some sort of server error possibly due to a misconfigured script or a web application’s processes crashing.

It Just Doesnt Connect

A timeout error happens when too many people are using the server, making it hard for the server to handle everything that’s going on.

How To Fix Cloudflare Error 524: A Timeout Occurred

  1. Refresh The Webpage
  2. Reinstall The Application
  3. Check Your Server Load
  4. Upgrade Your System
  5. Check Your Traffic On Port 80
  6. Move to a Subdomain
  7. Modify Your PHP Settings
  8. Contact Your Hosting Provider

If a user complains to you that their connection timed out it might not be your fault.

Not My Fault

First, make sure that the problem isn’t on their end.

1. Refresh The Webpage

Try refreshing the page. If that doesn’t help, close the browser and reload it. Sometimes a simple restart is all that’s needed to solve whatever is causing the problem.

If this doesn’t help, try clearing the cache & cookies before moving on to another step.

Restarting the browser won’t do this automatically, and sometimes a corrupted cache entry or cookie is all that’s interrupting your page from loading.

2. Reinstall The Application

If you’re experiencing an error with an application or a game, try re-installing it.

You can also contact your hosting provider to make sure that the server is not compromised.

If you get everything is working again, be sure to check your server’s traffic to see if other users may be experiencing the same problem.

Once you’re confident that the user’s computer isn’t the main issue, take the following steps to troubleshoot your Cloudflare web server.

3. Check Your Server Load

The most common cause of Error 524: A Timeout Occurred is excessive server load.

Server Overload

You can easily check how busy your origin server using the Cloudflare CLI is by running this command:

top -c

You’ll see the different processes running on your web server.

Look for resource-intensive tasks that are demanding high CPU and bandwidth usage.

For example, if there are too many PHP applications running too many procedures simultaneously, terminate them all.

Even though this may momentarily interrupt end-user activity it will kick open your server to accept traffic again.

MySQL processes can be an offender when too many sleep connections start stacking up.

There’s an easy command in the MySQL command prompt you can use to check for this:

show full processlist;

If you take these steps and manage to clear the 524 error then you’re on the right track. But these fixes are only a temporary stopgap.

If too many processes cluttered up your server once, it can happen again. Keep troubleshooting to get to the heart of the problem.

4. Upgrade Your System

If you keep seeing Error 524, it’s wise to check your server’s hardware. This error might pop up if your server’s memory or CPU is overloaded.

Simple as it may sound and frustrating as it may be, error code 524 may be a tip that it’s time to upgrade your web server hardware.

With modern equipment, you shouldn’t have trouble keeping your loading times under 100 seconds to avoid the Cloudflare error.

5. Check Your Traffic On Port 80

Under normal circumstances, your website should be able to handle traffic spikes. But error 524 means you’re facing abnormal traffic.


Anything from a faulty script to a DDoS attack could be overloading your server with HTTP requests. You can check IP address requests to your site using this server command:

netstat -an | grep 80

If you detect suspicious IP addresses spamming your server, you can block them using the command:

iptables -A INPUT -s ###.##.##.### -j DROP

And don’t forget to restart Apache:

systemctl httpd restart

It’s a good idea to regularly check on your HTTP traffic to ensure you’re not being spammed and that your web server bandwidth supports your site’s traffic as it grows.

Depending on your hosting provider, you may also be able to set up automated alerts to inform you about long-running activity spikes or suspicious connections.

6. Move to a Subdomain

If you’re sure there’s no DDoS attack and you know what’s causing the issue, you can avoid Error 524 by shifting the trouble-causing processes to a subdomain.

You can configure subdomains outside of your Cloudflare DNS app.

These “grey clouded” domains can run the processes in the background and send updates to the server without keeping the HTTP connection open.

This allows your Cloudflare to handle its incoming traffic requests while your web server handles cumbersome processes separately.

Contact your hosting provider for service-specific instructions on configuring a subdomain for your site.

7. Modify Your PHP Settings

If your web server is configured to run PHP scripts, you can set the max_execution_time variable in your php.ini file to the number of seconds you want.

For long-running scripts, a common practice is to extend load times to 2 minutes.

120 seconds is a slight increase from the default 100 seconds and is often enough extra time to allow PHP scripts to execute before triggering the 524 error.

8. Contact Your Hosting Provider

If you’ve exhausted all of the steps above and you’re still stuck, it’s time to contact your host.

Call For Help

Error 524 can appear for reasons beyond your control if there’s a problem at your host’s data center.

Let them know the error code, the time zone where the problem occurred, and the URL that threw the error.

This helps them identify and solve the issue as soon as possible.

If you’re looking for (free) tips to optimize your site speed with Cloudflare and rank higher on Google, you can follow me on Twitter 👉🏻 @bitofseo.

Please DM me if you have any questions about this Cloudflare article (or have some feedback to make it better 😄️).

About Jake Sacino

After working as an engineer and consultant for a bunch of big companies, Jake now works as a full-time SEO & software engineer.