/Fixing-Cloudflare-Error-524

This guide will show you how to fix Cloudflare's Error 524 (A timeout occurred)

Primary LanguagePHP

Fixing Cloudflare Error 524

This guide will show you how to fix Cloudflare's Error 524 (A timeout occurred)

Explanation

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.

Cloudflare will typically wait for a HTTP response from your server for 100 seconds. If no response(<8KB) is sent by your server in that time, Cloudflare will close the connection and serve a 524 error page.

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.

Fixing

To fix this, you need to send a >8KB data earlier than your "long-running process".

"Long-running process" Samples

see PHP CODE

Fixing Samples

see PHP CODE FIX 1 PHP CODE FIX 2

Author: Marcial Paul G. im.codename@gmail.com

Not working

Option #1: Turn off any compression that may minify the response of the file (gzip/deflate/br in apache/nginx)

Option #2: increment $spacer_size variable by 1 until it works