Try the suggestions in this Community Tip to help you fix Error 524: A timeout occurred.
Error 524 error indicates that Cloudflare made a successful TCP connection to the origin web server, but the origin did not reply with an HTTP response before the connection timed out. Typically, Cloudflare waits 100 seconds for an HTTP response. If the origin doesn’t respond in that time, Cloudflare closes the connection and you’ll see “Error 524: A timeout occurred”.
Quick Fix Ideas
This error is commonly caused by a long-running process on the origin server, such as a PHP application or a database query which the web server must wait on before responding to a request. This can also be caused by your origin server being overloaded - so as a first step it’s a good idea to check your server’s available resources, including CPU and RAM, and overall traffic levels. If your server has a high CPU load, or is low on memory, this could indicate a resource problem.
Investigate for issues at your origin server that might result in responses taking longer than 100 seconds to be generated. Ask your hosting provider/system administrator to check if there are any server issues. Reviewing your webserver access/error logs would be a good place to locate this information. If you have a Cloudflare Enterprise plan, contact Cloudflare Customer Support to make them aware of the issue to investigate options.
You should check your server health metrics such as available CPU & RAM and if you’re using a Database server, that should be checked as well for long-running queries. Review your origin webserver access/error logs which may provide more information on why those requests are timing out.
If you need to have scripts that run for longer than around 100 seconds without returning any data to the browser, you can’t run these through CloudFlare. There are a couple of options: Run the scripts via a grey-clouded subdomain or change the script so that it kicks off a long-running background process and quickly returns a status which the browser can poll until the background process has completed, at which point the full response can be returned. This is the way most people do this type of action as keeping HTTP connections open for a long time is unreliable and can be very taxing also.
If your running a VPS, like Windows VPS, make certain to adjust the firewall at the origin to not rate limit Cloudflare’s connecting IPs.
Your hosting provider has made server changes to their Railgun settings which resulted in Error 524. Go to the Cloudflare dashboard, select Speed, Railgun and test & select a working connection from the list of options.
If You Need More Help
This community of other Cloudflare users may be able to assist you, if not, login to Cloudflare and then contact Cloudflare Support. When you contact support, make sure to include as much of this information as possible: time stamped log files from your origin server, RayID, domain name, error messages, screen shots, and/or HAR file(s).
Expert Comments Appreciated
This Community Tip will remain open for input from Community experts and those familiar with this issue. We really appreciate comments that start with words like: “The three things I always try”, or “Do this first” or “In my experience”.
This is a Cloudflare Community Tip, to review past tips click here.