September 2, 2021

Notes about Cloudflare cache and json

I have spent a lot of time trying to understand how to setup cache for json and API requests in Cloudflare lately and finally i have made some progress. This is not a step by step guide but mostly a "notes to self" post so i can make some more sense of it all.

  • If workers are active on a route page rules are ignored. Took me a while to realize this.
  • Cloudflare only execute ONE page rule per request, so make sure the rules are in the correct order and you don't have any "catch all" rule at the top.
  • Also note that the above note is not applied to workers route, with workers the routes is matched by how detailed they are. I.e domain.com/test is used even if domain.com/* exist and the order doesn't matter.

After you know this it should simply be to set a custom page rule on the path you want to cache with the option

Cache Level: Cache Everything
© Copyright 2024 AlternativeTo . Powered with by CreativeDesignsGuru