Automatic activation Firewall Rules

Hello! First of all, I want to say that Cloudflare is a great service, many times saved my site from DDoS. There’re a lot of functions and settings, and new ones appear periodically. Thanks to the whole team and community!

I want to propose: add to dashboard the ability to create rules for the automatic activation of Firewall Rules. Yes, I know that there is “Rate Limiting”, but as I know it works differently, I tried it once and in my case it didn’t help.

Several times I dealt with DDoS and at first my site was very quickly blocked by hosting for a high load. And then I found this solution:

  1. Pre-created Firewall Rule, action = “Challenge” for all requests except bots.
  2. Every 3 minutes, CRON executes a shell script that counts the number of lines (= requests) in the htaccess file for the previous 3 minutes.
  3. If the result exceeds the set value (for example, 1000 requests) - the script executes the CURL command to the Cloudflare API for activate the firewall rule, after less than a minute the load drops, the site does not block.
  4. After a while, I manually turn off the filter.

The script showed efficiency (without it, hosting would continue to block site), but it isn’t a universal solution and the operation algorithm is a little stupid. So I would like to transfer this task to Cloudflare itself, create a rule like “If the number of requests to [all pages|specific page] in [x time] exceeds [y value], then [activate z filter]”.

That’s all I wanted to say. Thanks for attention.

Doesnt sound like a bad idea.