Cache Using Defaults Unless Specified By Origin Help

Hey guys
Im struggling to get my cache config right, even thoughI think I have a pretty standard requirement.
I feel like im just missing something here, hopefully someone can help.

Basically I the base caching setup (standard and 4 hours browser TTL) at my account level which is working.

I have a number of somewhat static JSON API endpoints that I also want to cache, however for about 15 minutes each respectively.

I have configured Page Rules to match those endpoints and set them to “cache everything”. I have also set the API endpoints for these specific routes to return cache control headers with a 15 minute expiry.

cache-control: public, max-age=1800, s-maxage=1800

When I cURL this endpoint (going through cloudflare) I can see that CF is modifying the header and changing the max-age to 14400

cache-control: public, max-age=14400, s-maxage=1800

Which is what my account level cache setting is… It just seems to ignore my cache headers and overrides anything from the origin.

I have tried enabling “Origin Cache Control” in the page rule, it doesn’t seem to do anything.

Basically I just want to use the account level CloudFlare cache settings for everytyhing, unless I have specified this manually via the cache control headers, which seems like a pretty standard use case.

I have confirmed that enabling “respect existing headers” in the account level cache settings does work, however then all my other resources have no cache headers, and im stuck having to define cache headers for everything manually instead of just the handful that I need to override.

How do I solve this? This seems like a pretty standard usecase to me, what am I doing wrong here?

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