How to Fix Cloudflare Error 524: A Timeout Error Occurred

Cloudflare displays Error 524: A Timeout Error Occurred when it connects to a web server but receives no HTTP response after waiting:

Cloudflare Error 524

After opening a TCP connection to the origin server, Cloudflare normally waits up to 100 seconds for a response.

Cloudflare uses HTTP to transfer data once that connection is established.

Need the fixes? Click here to skip the technical explanation.

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

Too many people using the server can leave it unable to handle the activity, causing a timeout error.

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

A user’s report of a timed-out connection does not necessarily mean the fault is yours.

Not My Fault

Check the user’s setup first to rule out a problem at their end.

1. Refresh The Webpage

Refresh the page. If it still fails, close and reopen the browser; a restart sometimes resolves the cause.

If that does not work, try clearing the cache & cookies before the next step.

Restarting the browser does not clear these automatically. A damaged cache entry or cookie may be the only thing preventing the page from loading.

2. Reinstall The Application

For an error affecting an application or game, try reinstalling it.

Ask your hosting provider to check that the server has not been compromised.

After restoring access, check your server’s traffic to see whether other users may have the same problem.

Once you have ruled out the user’s computer as the main cause, troubleshoot the Cloudflare web server with these steps.

3. Check Your Server Load

Excessive server load most commonly causes Error 524: A Timeout Occurred.

Server Overload

Check the origin server’s load using the Cloudflare CLI with this command:

top -c

The output lists processes currently running on your web server.

Identify tasks consuming high amounts of CPU and bandwidth.

For instance, if too many PHP applications are running procedures at the same time, terminate them all.

This may briefly interrupt users’ activity, but it lets the server accept traffic again.

Too many sleeping MySQL connections can also accumulate and cause problems.

Check for these with the following command at the MySQL prompt:

show full processlist;

Clearing error 524 with these steps indicates progress, though the fixes are temporary.

The processes that overloaded the server can build up again. Continue investigating to find the underlying cause.

4. Upgrade Your System

Recurring Error 524 is a reason to inspect your server hardware. Overloaded memory or CPU may be responsible.

Error code 524 may indicate that your web server needs a hardware upgrade, however frustrating that may be.

Modern equipment should keep loading times below 100 seconds and avoid the Cloudflare error.

5. Check Your Traffic On Port 80

A website normally handles traffic spikes. Error 524 indicates that its traffic is abnormal.

Traffic

A faulty script or DDoS attack could flood the server with HTTP requests. Use this server command to inspect IP address requests to the site:

netstat -an | grep 80

Block suspicious IP addresses spamming the server with this command:

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

Restart Apache afterwards:

systemctl httpd restart

Check HTTP traffic regularly for spam. Also check that server bandwidth can handle traffic as your site grows.

Your hosting provider may let you configure automatic alerts for prolonged activity spikes or suspicious connections.

6. Move to a Subdomain

Once you know the cause and have ruled out a DDoS attack, move the processes responsible to a subdomain to avoid Error 524.

Set up these subdomains outside your Cloudflare DNS app.

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

Cloudflare can then handle incoming requests while the web server runs the demanding processes separately.

Ask your hosting provider for subdomain configuration instructions specific to its service.

7. Modify Your PHP Settings

If your server runs PHP scripts, set max_execution_time in php.ini to your chosen number of seconds.

For scripts that take longer to run, extending load times to 2 minutes is common practice.

120 seconds allows slightly more time than the default 100 seconds. That extra time is often enough for PHP scripts to finish before error 524 occurs.

8. Contact Your Hosting Provider

Contact your host if the previous steps leave you unable to resolve the issue.

Call For Help

Problems at the host’s data centre can cause Error 524 for reasons outside your control.

Send the host the error code and the time zone where it happened, along with the affected URL.

Those details help the host identify and resolve the problem quickly.

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.