524 errors - modify PHP script to allow more than 100 seconds run

I’ve been searching this forum and all the www for a solution to this issue and I understand that for free accounts, there is this maximum 100 seconds HTTP response rule.

So how to enable running a PHP script that takes more than 100 seconds, without upgrading?

This is what I’ve tried:

  1. adding the following code in my script (found on github):
$spacer_size = 2048; // increment me until it works
echo str_pad('', (1024 * $spacer_size), "\n"); // send 8kb of new line to browser (default), just make sure that this new line will not affect your code.
if(ob_get_level()) ob_end_clean(); // end output buffering

echo "WOW, you waited me for 110 seconds.";
  1. added a WAF rule for the script URL so CF will skip all options listed there (to be honestly I don’t even know if WAF has anything to do with the 100 seconds time limit)

Ideas? Can it be increased? How?

The only way to increase is to pay for enterprise. Otherwise, if you need longer then 100 seconds you need to not use Cloudflare in front of your server.

1 Like

If it’s an admin task I run from my own computer, I add my server IP address to my local hosts file, so I’m connecting directly.