cms icon indicating copy to clipboard operation
cms copied to clipboard

[5.x] Add cache-control header to cached content

Open indykoning opened this issue 11 months ago • 1 comments

Closes https://github.com/statamic/ideas/issues/1309

Half and full caching strategies will get these improvements if these are pages that can be cached.

This PR will add cache-control public headers for pages that can be/will be/have been cached or have been served from cache if the webserver wasn't configured properly or query params did not match.

It can improve experienced speed and reduce server load by using local copies of statically cached content. And if combined with a properly configured CDN which supports caching pages can reduce server load as the CDN will serve the page and occasionally update it's cache.

~~(If you're using a CDN in-between you might not even need the full strategy anymore)~~ Edit: ^ That is not true (yet) since it still requires the csrf token + session, cookies will be sent. Which means CDNs will not cache unless specifically instructed to ignore the cookies

indykoning avatar Feb 07 '25 09:02 indykoning

This PR should now be ready to merge now, it is currently in use without any issues 🙂

indykoning avatar Mar 18 '25 12:03 indykoning