Respect my Cache Control while applying defaults to others

My Page Rule Settings:
Cache Level: Cache Everything
Edge Cache TTL: 1 month
Browser Cache TTL: 4 hours
Origin Cache Control: enabled

I observed that:
Cache Control: no-cache becomes Cache Control: max-age=14400, and Cf-Cache-Status: HIT.

It seems both Browser and Edge Cache TTL have overridden my Cache Control header.

How can I tell CF to respect my Cache Control, while having a default Browser and Edge Cache TTL for others which don’t have Cache Control Header.

Thank you guys!

Greetings,

Thank you for asking.

It’s 4 hours → default for Browser Cache TTL.

Using a Page Rule and selecting Origin Control Cache: On option.

Remove the Browser Cache TTL in your Page Rule.
I’d suggest you to set it to “Respect Existing Headers” from the dropdown menu under Caching → Configuration.

Then make sure to send the needed ones from your origin host/server and Cloudflare will respect them “as-is” from your origin host/server.

Purge Everything upon changes just in case.

Hm, if that would be in some kind of a “conflict”, as for example different cache headers for “domain.com” vs “sub.domain.com” or “domain.com/some-page/” vs “domain.com/assets/filename.extension”, either using a Page Rule or Transform Rules I would set the needed HTTP headers for some specific paths, if so :thinking:
→ Transform Rules “Header modification” execute the last so, you can even overwrite the ones you’ve set in a Page Rule

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