How to I delete cache on post requests?

I have a Cloudflare worker that will delete the cache of a file, triggered by a GitHub webhook.

I have done some testing, and the worker only has issues when given a POST request.

There is really no documentation on this other than a simple program.

How do I delete cachce when sent a POST request?

https://developers.cloudflare.com/workers/runtime-apis/cache/ and https://developers.cloudflare.com/workers/learning/how-the-cache-works/

This will only be the case if you’re already explicitly using the cache API in the Worker.

I cant find anything here about caching on post requests. Is there something i’m missing?

Cloudflare doesn’t cache post requests unless you’ve written worker code to do it. Are you caching post requests using a worker?

:edit: duh… reread original post.

You’d likely need to delete the cache key for that specific object in a worker call or change the cache key so it no longer matches the previously cached object.

https://developers.cloudflare.com/workers/runtime-apis/cache/

1 Like

Ok, thanks!

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