Cache control header not working for cache reserve

What is the name of the domain?

awesomeopensource.com

What is the issue you’re encountering

cache-control header max age set to 10 years in http response but getting cache bypass when cache rule set to respect response header. if I set a cache rule for edge cache ttl of 30 days it works fine but I want a 10 year expiration.

What steps have you taken to resolve the issue?

can’t get it to read the cache control header from the http response so cache reserve caches the response for 10 years.

What are the steps to reproduce the issue?

refresh a web page on the site. look at the cloudflare cache status response header and it says “BYPASS”. I will probably turn this back on to the cache rule for 30 days so you may not be able to repro it.

Screenshot of the error

May I ask if you are trying to cache and use cache reserve for the HTML document (which is a dynamic content-type and not cached by default)? :thinking:

Currently what I see:

Via the Cache Rule for Browser Cache TTL? :thinking:

Would respect what comes from the origin host/server, otherwise we’d modify it via Transform Rules → Modify Response Header, from my opinion.

That’s how long it should be kept at Cloudflare, and that’s the maximum for Cloudflare servers or rather up to 1 year (depending about which one we’re talking about).
Could be it’s not possible to keep it for longer than a year by the RFC and might break the Web browser’s as well :thinking: , which is why the result could be as BYPASS in your case.

Due to my curiosity, it’s unlikely you’d need to cache it for longer, or up to say 10 years? :thinking: Any particular reason?

yes these are html documents. I don’t see it documented anywhere that cache reserve has a 1 year cache expiration maximum. where do you see that? based on the docs, setting cache control to max age of the amount of seconds in 10 years with public, with a cache rule to respect what the cache control header says, should very much work. but it’s not. why not?

the response in your screenshot is using standard cloudflare cache, not cache reserve, which is why you see a max-age 0. I don’t want to clear that since I need that stuff to be cached until it expires and gets picked up by reserve cache. look around at a few other pages on the site and you’ll see one with the long max-age cache control value.

it does not appear that the current RFC prohibits cache control max age of greater than a year.

the reason I want a long cache expiration is I want to fault the cache on write so I always get cache hits but then also can update the pages as needed as things change. on that note, is there an api to fault the cache reserve cache?

will this purge the cache reserve cache for a url?

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