Consider using multiple directives to ensure rules are applied in a fine-grained manner. If using a customer-managed CDN, a different header may be required depending on your CDN provider.Įxercise caution when setting either global cache control headers or similar cache headers that match a wide regex so they are not applied to content that you must keep private. The Surrogate-Control header applies to the Adobe managed CDN. Header set Surrogate-Control "max-age=3600" That said, exercise caution when turning off default caching.Ĭan be overridden for all HTML/Text content by defining the EXPIRATION_TIME variable in global.vars using the AEM as a Cloud Service SDK Dispatcher tools.Ĭan be overridden on a finer grained level, including controlling CDN and browser cache independently, with the following Apache mod_headers directives: This method is useful, for example, when your business logic requires fine-tuning of the age header (with a value based on calendar day) since by default the age header is set to 0. the default HTML/Text caching setting can be disabled by defining the DISABLE_DEFAULT_CACHING variable in global.vars:.by default, cached by the browser for five minutes, based on the cache-control header emitted by the Apache layer.This page also describes how the Dispatcher cache is invalidated and how caching works at the browser level regarding client-side libraries. Dispatcher also respects the resulting cache expiration headers if enableTTL is enabled in the Dispatcher configuration, implying that it refreshes specific content even outside of content being republished. Rules can be applied to the Dispatcher configuration to modify any default cache expiration settings, resulting in caching at the CDN. To increase performance, Dispatcher is used primarily as a cache to limit processing on the publish nodes. Vercel) or run your web server on your own.Traffic passes through the CDN to an Apache web server layer, which supports modules including Dispatcher. It should be fairly straightforward even if you use a different platform (e.g. When it comes to Netlify, hooking into and altering their default caching behaviour is literally a piece-of-cake-task. We have already touched on the configuration part - it’s as straightforward as adding an additional header to outgoing responses. If you’re looking for an in-depth explanation, consult with the MDN docs. Consequently, we are gaining on speed by reducing the roundtrips between the browser and the server.Įxplaining the ins and outs of the HTTP Cache flow, making sure of cache freshness with ETag and Last-Modified in particular, is beyond the scope of this article. Instead, so long as the cached response’s lifetime has not expired yet, the browser will intercept the request and reuse the previously cached response to fulfill it. One of the major benefits of caching is that on subsequent requests to the same asset, the browser does not need to carry out the transmission of the request towards the server over and over again. Besides, if configured, it augments the response headers with Cache-Control to specify the directives for caching mechanisms (for example, for how long the cache will be considered fresh). The web server processes the request and acts accordingly - it sends the requested asset back over the wire.If there’s no cache that would fulfill the request or the cache is stale, the request gets forwarded to the web server.When the browser encounters a request to an asset while parsing your HTML's metadata, it checks whether there’s already a valid cache response in its cache, before reaching out to the web server.You may need to vary either the route or the cache-control values - or even both! - to suit your particular needs. Enter fullscreen mode Exit fullscreen mode
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |