Show Capcha after X requests to non-existent pages - possible?

Is it possible to set up the following logic: after 5 (whatever) requests to non-existing pages (that resulted in 404 response) to show Capcha ? Thanks

Cloudflare can’t do that directly, but you can code it.

Log the 404s on your origin and when the limit is hit add the IP address to a Cloudflare list using the API…

Use that list in a WAF rule that requests a challenge.

1 Like

yes, that’s a viable option. Thanks
The question though is whether it’s possible to handle the entire logic on CF end. Sounds like a really nice to have feature.

Apart from rate limiting, the WAF is stateless and handles each request independently. Also, as it only handles requests, the 404 is a response from your origin and isn’t seen by the WAF.

1 Like

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