Skip to content

0850 304 56 78

İlgiHost

How to Fix Cloudflare Error 524

Cloudflare error 524 indicates that the origin server did not respond within the timeout period. This guide covers the causes and solution steps for WordPress and WooCommerce sites.

İlgiHost 16 min read

How to Fix Cloudflare Error 524: Causes and Step-by-Step Solution

What is Cloudflare error 524?

Cloudflare 524 error occurs when Cloudflare can successfully connect to your origin server, but the server does not return an HTTP response within the set timeout period. In short, the connection was established, but the response did not arrive in time. In this case, the visitor usually sees a Cloudflare error page with the message "A timeout occurred".

This distinction matters for troubleshooting. A connection that cannot be established at all (for example, because the server is down or a firewall is blocking it) points to a different type of error. With a 524, the server is reachable; the problem is that the response to the request takes too long.

Where the error occurs: A 524 occurs not between the visitor's browser and Cloudflare, but between Cloudflare and the origin server. For this reason, changing the visitor's internet connection or browser often does not change the result. The main area to investigate is your server, your application and your database.

There is one more point to keep in mind: while the error page is being displayed, the origin server may still be processing the request. In other words, even if the user sees an error, the operation may continue in the background. This can cause problems, for example in a payment or import operation, where the user refreshes the page and triggers the operation twice.

Not a standard code: 524 is not a standard HTTP status code defined in RFC 9110; it is a Cloudflare-specific extension. Therefore, you only see this code on sites that pass through Cloudflare. When the origin server is accessed directly, the same page usually does not return this error code, but a slow response may appear in other forms (browser timeout, 504, etc.).

How many seconds is the timeout?

There is no single fixed answer to this question. Cloudflare applies a timeout period for the Cloudflare 524 error: Cloudflare connects to the origin server, but if the server does not provide an HTTP response before this period expires, a 524 is returned. However, different values for this period appear in various sources.

  • 100 seconds: The value found in older guides.

  • 120 seconds: Listed as the default Proxy Read Timeout in some indexed versions of the Cloudflare support page.

  • 125 seconds: Listed in another version of the Cloudflare page and in some third-party sources.

This inconsistency is most likely due to documentation being updated over time and older content remaining in circulation. That is why we do not give an exact number. To find out the current value, see Cloudflare's official connection limits documentation; you can also check there whether it differs depending on your plan.

A small detail: Cloudflare states that there may be a difference of about 1 second between the time shown in the browser and the moment the error is actually returned. So do not expect the page to return the error at exactly the limit in seconds; consider this small deviation normal in your own measurements.

The practical point is this: if your page responds in times approaching several minutes, knowing the exact number does not change the solution. You need to shorten the operation's duration or move it to the background. Also, the origin may continue processing during the error; that is, even if the request has been completed in the background, the visitor may see a 524.

Common causes of error 524

A 524 error occurs when Cloudflare successfully connects to the origin server but the server does not return an HTTP response before the timeout period expires. In other words, the problem is usually not between the visitor and Cloudflare, but between Cloudflare and the origin. So the real question is: Why is your server responding to this request so late? The following causes are the most common in practice.

Long-running scripts, heavy queries and an overloaded server

The most common cause is an operation that takes too long to produce the response. Typical examples:

  • Reporting, export or import scripts that process large datasets in a single request,

  • Heavy database queries that run on tables without indexes or join many tables,

  • Heavy tasks run within the request, such as backup, bulk email sending or image processing,

  • An overloaded server whose CPU, RAM or disk I/O resources are exhausted; in this case even requests that are normally fast wait in a queue.

Slow database and third-party API calls

If your application depends on another system before responding, that system's slowness adds directly to your response time. A late database connection, locked queries, a full connection pool or a slow-responding external API (such as payment, shipping, email or license services) can hold up the entire page. When these delays accumulate, Cloudflare's wait time is exceeded.

Exceeding the time to write data to the origin

The timeout does not occur only while waiting for a response. Cloudflare has a separate limit for writing data to the origin, and if the write is not completed in 30 seconds, a 524 may also be seen. Large file uploads or a slow origin connection can cause this.

An important detail: when a 524 is seen, the origin may still be processing. In other words, even if the user sees an error, the operation may be completing in the background; for this reason, checking the result before submitting the form again prevents duplicate records.

First, confirm the source of the error

With a 524 error, Cloudflare was able to connect to your origin server, but the server did not return an HTTP response before the timeout expired. In other words, the problem is not between the visitor and Cloudflare, but between Cloudflare and the origin. Before moving on to a fix, confirming that the error really originates at the origin and where it is triggered will keep you from wasting time in the wrong place.

1. Trace the error

Instead of treating the error as a random issue, document it:

  • Which URLs: Does the error appear across the whole site, or only on certain pages (such as reports, bulk imports, checkout, or admin panel operations)?

  • At what times: Does the error cluster at certain times (backup, cron jobs, peak traffic)?

  • Request type: Does the problem occur on GET requests, or on POST requests such as form submissions?

These notes help you tell whether the problem is general slowness or a single heavy operation. If it repeats on a single URL, the query or operation on that page is most likely taking too long.

2. Test the origin response without Cloudflare

Try the same request after temporarily disabling Cloudflare (by switching the DNS record to DNS-only mode) or by accessing the server directly. You can interpret the result as follows:

  • If the direct request also takes too long or hangs: The problem is on the origin side; the application, database, or server resources should be examined.

  • If the direct request returns quickly: Look at details in the connection layer, such as firewall rules, Cloudflare's origin IP being blocked, or the network path.

Note: Turning off Cloudflare temporarily leaves your site unprotected, and DNS changes may take time to propagate. So keep the test short and, if possible, run it during off-peak hours. Measuring the response time with a command-line tool instead of a browser is also useful. Also keep in mind that the origin may continue processing when the error occurs; that is, even if the user sees the error, the operation may be completing in the background.

3. Check server resource usage

Examine CPU, RAM, disk I/O, and the number of concurrent processes at the times the error occurs. Insufficient memory, saturated PHP worker processes, locked database queries, or background tasks such as backup can delay responses. Compare the error logs (web server, PHP, and slow query logs) against the same time window. For diagnosing slowness, you can use the server slowness guides on our blog.

Solution steps on the origin side

A 524 error indicates that Cloudflare was able to connect to the origin server, but the server did not return an HTTP response within the timeout period. For this reason, the solution usually lies not in Cloudflare settings, but in finding and speeding up the slow request on the origin side. Following the steps below in order will help you narrow down the source of the problem.

Instead of guessing which request causes the error, check the server logs. To find the slow request, you can examine the following:

  • Apache or Nginx access logs: If you are not logging response time, add a duration field to the log format ($request_time in Nginx, %D or %T in Apache). Then look at the duration for the URLs where the error appears.

  • Error logs: Upstream timeout entries in Nginx or timeout messages in Apache show where the request got stuck.

  • PHP-FPM slow log (slowlog): If you enable the request_slowlog_timeout setting, the PHP call stack of requests that exceed the specified time is recorded. This way you can see which file and function is waiting.

  • PHP-FPM status: If all workers are busy, new requests wait in the queue. This can also be a sign of another slowdown.

Watch whether the same URL keeps standing out. The problem is usually a single admin page, report, import, or form operation.

Typical sources of slowness on WordPress sites are as follows (the WordPress-specific recommendations in this section are based on general technical experience and have not been separately verified in Cloudflare documentation):

  • Heavy plugins: Disable plugins one by one (preferably in a staging environment) and test whether the error disappears. Backup, security scanning, import, and SEO analysis plugins are common suspects.

  • Cron jobs: Because WP-Cron can be triggered on every visit, accumulated or long-running tasks can delay requests. Setting up a real server cron and connecting WP-Cron to it separates this load from visitor requests.

  • Slow database queries: Enable the MySQL/MariaDB slow query log, and check for missing indexes and autoloaded data in a bloated wp_options table. Cleaning up expired transients and unnecessary revisions can help.

  • Caching: Page and object caching reduce how often PHP and the database have to run again on every request.

  • PHP resources: If memory and the number of workers are insufficient, operations queue up; review the settings according to server capacity.

Your page may be waiting for another system before it responds. Check the following:

  • Third-party APIs: If payment, shipping, license verification or social media integrations do not respond, the request hangs. Define reasonable, short timeout values for connecting and reading in your code, and design a fallback behavior that lets the page continue without waiting when an error occurs.

  • Database connection: If you use a remote database, review latency, the connection limit and locked queries.

  • DNS resolution: Delays the server experiences when resolving external services can also lengthen requests.

Move long-running tasks to the background

A 524 error is more often caused by too much work being loaded into a single HTTP request than by a slow server. Cloudflare returns this error when it can connect to the origin server, but the server cannot send an HTTP response before the timeout expires. The origin may keep processing during the error; in other words, even if the job finishes in the background, the user sees the error page. For this reason, the most robust approach is to separate long-running work from the request rather than keeping it inside the request.

The basic idea is simple: the request coming from the browser only queues the job and responds immediately, while the job itself runs in a separate process.

The following types of jobs are typical candidates:

  • Large data export operations (order, customer or report files)

  • Bulk product import (uploading hundreds of products via CSV or XML)

  • Bulk e-mail sending, image resizing, backup creation

  • Synchronization jobs that fetch many records from a third-party API

These jobs should be run through a queue worker, a scheduled task (cron) or a command-line script, not while the user waits on the page. For WordPress and WooCommerce, plugins may have their own background processing options; this is not guaranteed for every plugin, so check the plugin documentation.

If the user needs to see whether the job has finished, set up the following flow:

  1. The client sends the request that starts the job.

  2. The server adds the job to the queue, generates a job ID and responds immediately.

  3. The client queries a small status endpoint at regular intervals: pending, running, completed or error.

  4. When the job finishes, the result, for example the download link of the finished file, is provided in the status response.

Because each query is short, it does not approach the timeout limit. Do not poll too frequently; an interval of a few seconds is usually sufficient and does not create unnecessary load.

If the background job runs on the same server, it can still consume the CPU and memory share of web requests. Moving heavy jobs to a separate server or a dedicated worker process relieves the main web server. When doing so, pay attention to the following:

  • Limit the number of workers and concurrent jobs according to server resources.

  • Keep retries and error logs for failed jobs.

  • Split large jobs into small chunks (for example page by page or in groups of a hundred records); if one chunk fails, the whole job does not start over.

  • Design jobs to be repeatable (idempotent) to prevent the same job from running twice.

  • If your resource needs exceed your web traffic, this setup can be built in a more flexible environment such as a VPS; running background workers as a system service is often not possible on shared hosting.

What you can do on the Cloudflare side

It may not always be possible to fix slowness on the origin side. For example, if an admin panel report, bulk import or a long-running operation URL regularly exceeds Cloudflare's waiting time, the 524 error will keep appearing. Remember that the error occurs between Cloudflare and the origin server, and that the origin can continue processing in the meantime. That is, the operation may be completing in the background, but the response never reaches the browser.

One option you can consider for such URLs is to use the relevant URL without proxy (DNS only). To do this, you can move the operation or admin URL that regularly exceeds the time limit to a separate subdomain and set its DNS record in Cloudflare with the proxy turned off (gray cloud).

  1. Identify the URL that exceeds the time limit and create a subdomain dedicated only to this operation.

  2. Add the DNS record of this subdomain without proxy.

  3. Run the long-running operation through this address and leave the main site proxied.

  4. Test the result and still monitor the operation's response time.

When the proxy is turned off, the protection and caching benefits provided by Cloudflare are disabled for that address. As a result:

  • The IP address of your origin server becomes visible through DNS.

  • Cloudflare's traffic filtering and attack mitigation layer does not work on this address.

  • Because caching is not used, all requests come directly to your server.

For this reason, use this method only for addresses where it is truly necessary, protect these addresses with a strong password, IP restriction or additional authentication, and keep your main site proxied. This solution does not fix the problem, it only bypasses the timeout limit; for a permanent solution, it is better to speed up the operation or move it to the background.

Lasting solution: the right infrastructure

The methods described in the previous steps (optimizing slow queries, caching, moving long-running processes to the background) usually resolve the 524 error. If the error still recurs at certain times or when traffic increases, the problem may not be in the code but in insufficient server resources. Cloudflare's 524 error means the origin server could not respond within the timeout period; if the server is constantly strained in terms of CPU, RAM or disk I/O, responses will be constantly delayed as well.

Before considering an infrastructure change, check the following:

  • Is the error tied to a specific operation, or does it appear on all pages?

  • Do the server load graphs (CPU, memory, I/O) coincide with the moments the error occurs?

  • Are your hosting plan's limits (number of PHP workers, memory limit, concurrent processes) being reached?

  • Could the load from other sites sharing the same server be affecting you?

If the resource shortage is persistent, there are two options to consider:

  • A server suited to WordPress: An environment configured according to WordPress's database and PHP requirements can help dynamic pages be generated faster.

  • Cloud VPS with isolated resources: Having CPU and RAM dedicated to you lets you run without being affected by the load of other sites. In return, managing the server (updates, security, configuration) requires more responsibility.

Which one is suitable depends on your traffic, plugin setup and technical knowledge. A more powerful server will not completely eliminate an inefficient query or a faulty plugin; therefore, the right order is to measure the bottleneck first, then scale up resources.

For agencies hosting multiple client sites in one place, one client's heavy process can slow down the response times of the others and lead to a 524 error. With Dedicated Reseller, resources can be isolated; this way, a heavy process on one site does not affect all clients at the same time. This setup is especially useful for agencies that want to manage separate resources for each client.

Frequently asked questions

Are error 524 and error 522 the same thing?

No. 522 means the connection could not be established, while 524 means the connection was established but the response did not arrive in time.

Is site data lost when a 524 error occurs?

Generally not; the origin may continue the process in the background. Still, you should check the outcome of critical operations.

Can I extend the timeout period myself?

The default period generally cannot be changed on standard plans; it is better to speed up the process or move it to the background instead. See the Cloudflare documentation for current limits.

What should I do if the error appears only in the WooCommerce admin panel?

Large exports or bulk operations are likely; split them into smaller parts or run them in the background. Since there is no verified source on this, confirm with logs.

Sources