“The Cloudflare 524 error is an indication that Cloudflare successfully established a connection with the origin web server, but did not receive an HTTP response within the default 100-second connection timeout period, as stated by Cloudflare.”
In simpler terms, this error occurs when the origin server takes an excessive amount of time to process a request. Such delays can be attributed to the server being overloaded with work or struggling for resources, thus failing to respond promptly.
While server-side issues can cause 524 errors, they are often associated with websites experiencing sluggishness or queries being stuck due to various errors. To begin troubleshooting and identify the underlying cause, we recommend examining your ErrorLog. Acquiring the skill of utilizing the ErrorLog is considered good practice when attempting to diagnose issues on your website. Maintaining a clean ErrorLog makes it easier to identify problems. Please note that our ErrorLog primarily outputs errors that our main web server sees (Apache). For more comprehensive errors related to WordPress, enabling WP-debug mode is recommended.
Utilizing the Query Monitor Plugin for WordPress
A useful method for examining the loading process, queries, and the number and duration of requests on your site is by using the Query Monitor WordPress plugin. Upon installation, accessing your WordPress backend will reveal the plugin in the top menu bar. This plugin offers several useful tools for comprehending your site’s operations, enabling you to monitor and inspect slow-running queries, requests, API calls, and more. Paying particular attention to page loading time is crucial. The overview section provides a quick overview of the time taken by different components. For more detailed information on the plugin, consult their official documentation.
Debugging with WP-CLI
All our servers are equipped with WP-CLI, which allows for convenient debugging. However, this method requires SSH access to your site. After logging in using the credentials provided in your Control Panel, execute the following command from ~/public
.
wp profile stage
When processing a request from a browser, WordPress executes it as one continuous PHP script. The command breaks the script into three stages:
bootstrap
– is where WordPress is setting itself up, loading plugins and the main theme, and firing the init hook.main_query
– is how WordPress deals with requests and processes them in its queries.template
– is where WordPress determines which theme template to render based on the main query, and renders it.
WP Doctor is another valuable tool for diagnosing issues on your site. It is specifically designed to assist in identifying problems related to WordPress websites, such as failed updates, blank pages, upload issues, and more. To gain a deeper understanding of these tools, refer to our article titled “How to Diagnose Your WordPress Site Using WP Profile and WP Doctor.“
Resolving Cloudflare 524 Errors
Initially, clearing your cache and cookies, closing the browser, and attempting to access the site again can often resolve temporary instances of the 524 error. Beyond that, the recommended and optimal solution for fixing the 524 timeout error is to ensure that all long-running processes are either mitigated or moved. For instance, scripts that require more than 100 seconds to execute should not be used at all, as doing so will likely increase the frequency of 524 errors for visitors accessing your site.
An alternative approach is to bypass Cloudflare’s proxy, allowing you to identify the actual problem without it being obscured by Cloudflare. You can test this by checking the Host IP to which your website is pointing. In the Cloudflare DNS settings for your domain, change the cloud (proxy) from orange to grey and select “DNS only.”
However, please be aware that if you choose to bypass the proxy, self-signed SSL certificates will not function as intended, potentially leaving your site insecure. Cloudflare’s proxy is necessary to safeguard your site when using self-signed certificates.
For any further inquiries or questions regarding this matter, please do not hesitate to contact our Support Team via chat.