Worker request Billable Usage


#21

What’s defined a good request?


#22

A request that passes rate limiting.


#23

Thank you

I will have to keep my eyes peeled for an update introducing caching in front of workers.

Regards


#24

Maybe this works?


#25

Nope, the Worker is still called.


#26

You could use the global variable, to see if users are abusing your worker.

If so call the cloudflare api
POST zones/:zone_id/firewall/access_rules/rules

https://api.cloudflare.com/#firewall-access-rule-for-a-zone-create-access-rule

Then they should be block from using your worker.


#27

I had the same idea this morning and it should work.

Like, adding a rate-check inside the worker and then add the IP to a KV block-list, after 10 consecutive abuses the IP is blocked via the API.

Plus, we could monitor blocked requests via the Firewall event log and whitelist any IP that we know are not abusers.


#28

Good thinking guys. A neat solution.

The value proposition of just being able to say this response should be served from cache rather than invoking a worker is overwhelming though. For example, a high traffic version of the coinbase api example; one would expect the cost benefit to go something like, let’s update the bitcoin/alt price every minute, not on every request. That appears to be missing and ironically is from what I can tell, the original value add from cloudflare.


#29

Also consider the benefits in decreased costs elsewhere that would make up for the increase in cost…even the potential abuse. Also factor in the increased revenue from the site (depending on how it is monetizing).

Also if you are under attack you could shut workers off and or request a refund from Cloudflare


#30

I doubt that.