Automatic Firewall Rules

Hello, community,

Is there a way to automatically turn on/off firewall rules based on analytics?

An example would be, if there are more than 1k requests over the last 1 hour, the firewall rule gets turned on.

If that’s not possible within the Cloudflare dashboard to be done automatically, is there an option to pull a number of requests from the API and with what call is it possible to turn a firewall rule on via the API?

All the best, Matic

I don’t think it is possible.

You’d need to query the GraphQL API for the Analytics [Edit: Analytics, not Firewall Events]
https://developers.cloudflare.com/analytics/graphql-api/getting-started/

then update the firewall rule with the regular API
https://api.cloudflare.com/#firewall-rules-properties

2 Likes

Perhaps a rate limiting rule would meet your needs.

3 Likes

Hi @cscharff & @cbrandt ,

Thank you to both of you so much for the info. It helped me a lot and was able to make it work with GraphQL API. I will definitely also check rate-limiting in case this setup proves to be not as effective.

All the best and have a great day, Matic

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.