I have a service that sends JSON to the end user. The service URL is as following: http://<service>/<path>?siteCode=*
.
siteCode
may change and for every change of code a different resource must be returned from the service.
Basically, I need to cache JSON response for every siteCode
that was requested. I want the cache TTL to be configurable from my service side via Cache-Control
headers. I’ve set up a rule in Cloudflare like this:
URL: http://<service>/<path>?siteCode=*
Cache Level: Cache Everything
Edge Cache TTL: 1 hour
Origin Cache Control: on
And my service returns this header:
Cache-Control: public, max-age=7200
But for some reason Cloudflare ignores that header and caches the responses only for 1 hour as it was set up in the page rule.
What am I doing wrong?
I have a pro account in Cloudflare.