Should Cache-Control "public, max-age=3600, make Cloudflare cache JSON responses?
I'm trying to get cloudflare to cache some JSON responses, since their pretty static. I thought I would be able to use Cache-Control to set the cache time on the edge of cloudflare. But even after setting this I doens't seem to work.
I can see the header in the reponse headers, also tried CDN-Cache-Control.
Can you not do this with headers?
2 Replies
If it's not one of the default cached extensions (https://developers.cloudflare.com/cache/concepts/default-cache-behavior/), which JSON isn't, you need a Cache Rule to force it
Your cache rule can check if it's the hostname, starts with specific path, ends with path being a file extension, etc
Cool I ended up doing that but wanted to be doubly sure 🙂
Thanks for the info 🙂