Learn

HTTP Caching

As of v1.7, Statamic adds a Last-Modified header to all page loads and files passed through the bundle asset pipeline. This header will help browsers determine if a full page-download is needed, or if it can use its locally-cached version of the page.

To assist with HTTP caching even further, we’ve also added a new setting (currently marked experimental) called _http_cache_expires. When this is set to a time value (for example, 30 minutes), Statamic will add an Expires header to every page request (and all of the resources pipelined from bundles).

By using these settings, you can now set up site accelerators like Varnish to make your pages load lightning quick.

It won’t always work correctly in all situations (for example, when you need session or cookie data like shopping carts), so keep that in mind.

_http_cache_expires: 1 day

This article was last updated on March 30th, 2016. Find an error? Please let us know!