Cloudflare worker should not count OPTIONS and unauthorized accesses

Workers limits count everything.
So, imagine I use a worker for a personal project,
there is no way to “firewall it” to unauthorized requests.
Obviously I implemented it in the worker logic but the counter counts everything.
Since browsers send an OPTIONS request before the actual GET/PUT/DELETE, the counter counts double every request.
Also, if I check the origin or originating ip address and issue a 403, the request is still counted.

Solution:
do not count if the result of the worker is anything different than 200 and do not count if the request is OPTIONS.