LessUse
CDCloudflare Developers
•Created by LessUse on 11/4/2023 in #workers-help
cloudflare worker not counting requests to specific **API** routes
I have a fastapi application running on render at this url: https://example.onrender.com. the application is protected by cloudflare. i have various api routes such as https://example.onrender.com/v1/xxx, https://example.onrender.com/v1/yyy, etc.
my goal is to count the number of requests made to these specific routes. to do this, i deployed a cloudflare worker that is designed to increment a counter in a cloudflare kv namespace whenever a request hits one of these api routes.
i set the worker route to
example.onrender.com/v1*
on the cloudflare dashboard. this way, it should match any of the /v1/ routes.
the issue is that my cloudflare worker does not seem to be incrementing the counter when i make requests to these routes. the worker request count on the cloudflare dashboard also does not seem to update — it remains unchanged.
my cloudflare worker script:
2 replies