Implement rate limiting with Workers?


#1

Because Cloudflare’s Rate Limiting feature only works for uncached assets, I can’t use it with the setups I have for my websites. But perhaps a Worker can help?

Would be grateful for anyone who can send me of to the right path.


#2

I don’t believe that is the case any longer. We recently added a feature to more finely tune rate limiting based on response headers. New rate limiting rules by default have cf-cache-status not equal to HIT, but you could change that to equal to HIT (to count cached hits only) or remove that criteria altogether to count all requests.


#3

Thanks for the quick reply!

You’re right, it’s indeed possible now I see here in the help. (This help page still has the old information that cached resources are never rate-limited.)

Anyhow, rate limiting cached requests requires a Business plan or higher, which is not the case for my websites. So if it’s possible with Workers then that would be helpful.