This document contains information about a future release and not the current stable version (4). Be aware that information on this page may change and API's may not be stable for production use.
By default, PHP adds caching headers that make the page appear purely dynamic. This isn't usually appropriate for most sites, even ones that are updated reasonably frequently. SilverStripe overrides the default settings with the following headers:
Last-Modifieddate is set to be most recent modification date of any database record queried in the generation of the page.
Expirydate is set by taking the age of the page and adding that to the current time.
Cache-Controlis set to
- Since a visitor cookie is set, the site won't be cached by proxies.
- Ajax requests are never cached.
Customizing Cache Headers
Used to set the max-age component of the cache-control line, in seconds. Set it to 0 to disable caching; the "no-cache"
Pragma will be included.
Used to set the modification date to something more recent than the default. DataObject::__construct calls HTTP::register_modification_date( whenever a record comes from the database ensuring the newest date is present.
Vary: cache header
By default, SilverStripe will output a
Vary header (used by upstream caches for determining uniqueness)
that looks like
Cookie, X-Forwarded-Protocol, User-Agent, Accept
To change the value of the
Vary header, you can change this value by specifying the header in configuration
HTTP: vary: ""