Cache-control header by page

Is possible configure the cache-control header by page?

Nope, please add a feature request here: https://github.com/getgrav/grav/issues

1 Like

@rhuk what about this?

https://learn.getgrav.org/content/headers#cache-enable

Cache Enable

cache_enable: false
By default, Grav will cache the contents of the page file to ensure things run as fast as possible. There are advanced scenarios where you do not want the page to be cached.

An example of this is when you are using dynamic Twig variables in your content. The cache_enable variable allows this behavior to be overridden. We will cover Twig Content variables in a later chapter. Valid values are true or false.

I think @jrivero is referring to HTTP headers :upside_down_face:

May be :slight_smile: But I was looking for a way to disable cache on a single page myself today, so I’m sharing what I’ve found :slight_smile:

1 Like

Yes, my understanding was he was looking for the cache-control header option to be set by page. That option is an internal grav cache enable/disable by page.

Yes, I need define the time (max-age), and if cacheable (public, private, etc.) on each page type for the browser and varnish. I have some pages that change a lot and is interesting have a cache of 1 hour and other that change little a cache of 1 day.

https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html

This has been added and works in conjunction with expires: https://github.com/getgrav/grav/commit/13341c323d43eb47562d8ae72eae730e3e0e2cee

2 Likes