Notification when cache is used




I have a downloading website and I use CloudFlare.

I have a downloads counter which I increment at every request.
The problem, of course, is that if I use caching, the counter does not increment at all.

Of course, I could do that clientside, but that would mean that simply accessing the address of the resource does not increment the counter.
Is there any way to have a request triggered every time the cacehd version of a certain resource is provided to the client?


You could write a worker to call your origin to increment a script or other mechanism for counting downloads.


Maybe it’s just me, but this seems like a resource that should return Cache-Control headers to prevent caching by Cloudflare as you want this resource to be accessed by the browser.


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