![]() The default_ttl only applies to non-static responses, that is, those generated by your application. file is configured to set a cache lifetime, then this value is ignored in favor of the application headers. If the application code returns a Cache-Control header or if your. If no Cache-Control header is in the response, then the value of default_ttl is used. The cache duration is decided based on the Cache-Control response header value. default_ttlĭefines the default time-to-live for the cache, in seconds, for non-static responses, when the response doesn’t specify one. If your site uses a session cookie as well as 3rd party cookies, say from an analytics service, cache : enabled : true cookies : Ĭauses all cookies beginning with SESS or SSESS to be part of the cache key, as a single value. This is done by sending the following header: X-Platform-Cache: BYPASS.įor example, for the cache key to depend on the value of the foo cookie in the request. cookiesĪ list of allowed cookie names to include values for in the cache key.Īll cookies bypass the cache when using the default ( ) or if the Set-Cookie header is present. Use the cookies value, instead.Ī full list of HTTP headers is available on Wikipedia. The Cache key is the union of the values of the Header fields listed in Vary header, and whatever is listed in the routes.yaml file.Īccept-Encoding, Connection, Proxy-Authorization, TE, Upgrade Multiple header fields can be listed, separated by commas. ![]() All other values override default_ttl.Ī list of header fields to be taken into account when constructing the cache key. Responses with the Cache-Control header set to Private, No-Cache, or No-Store aren’t cached. Some headers trigger specific behaviors in the cache. The cache is only applied to GET and HEAD requests. Alternatively, the cache clears on a rebuild, so triggering a rebuild (pushing a new commit) effectively causes a complete cache flush. The HTTP cache doesn’t support a complete cache flush, but you can invalidate the cache by setting cache: false. If the If-None-Match header is sent in the conditional request when Etag header is set in the cached response, your application can extend the validity of the cache by replying HTTP 304 Not Modified. When the cache is expired (indicated by Last-Modified header in the response) the web server sends a request to your application with If-Modified-Since header. The web server doesn’t honor the Pragma request header. Conditional requestsĬonditional requests using If-Modified-Since and If-None-Match are both supported. If no Cache-Control header is in the response, then the value of default_ttl key is used. cache : enabled : true cookies : headers : Duration To configure the HTTP cache, add a cache key to your route. The HTTP cache is enabled by default, however you may wish to override this behavior. Mixing cache services together most likely results in caches that are stale and can’t be cleared.įor more details, see best practices on HTTP caching. You should not use the Platform.sh HTTP cache if you’re using Varnish or an external CDN responses with the Cache-Control header set to Private, No-Cache, or No-Store aren’t cached.the router respects whatever cache headers are sent by the application.you can configure cache behavior for different location blocks in your. ![]() When a request comes with the same cache key, the cached response is reused. If a request is can be cached, Platform.sh builds a cache key from several request properties and stores the response associated with this key. The cache can be controlled using the cache key in your. Caching is enabled by default, but is only applied to GET and HEAD requests. Platform.sh supports HTTP caching at the server level. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |