A 524 error states that CloudFlare was able to make a TCP connection to the origin, but the origin did not reply with a HTTP response before the connection timed out. This means that CloudFlare is able to make a network connection to the origin server, but the origin server took too long to respond to the request.
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. Working with your hosting provider or server administrator to identify these processes and stopping or making them run more quickly is the best way to resolve these errors.
Another alternative is to move those long-running processes to a subdomain that is not proxied by CloudFlare. That subdomain would appear as a grey cloud in the CloudFlare DNS Settings if not proxied. Note: You cannot use a Page Rule to avoid this long-running process error.