The Marfeel CDN Package and Cache-Control Headers

Cache-control headers define browser caching policies for both requests to servers and their responses. In more simpler terms, its a technique that defines how long a copy of content should be stored at the CDN level so it can be served back quicker, preventing the request from having to go to the origin server to download it and bring it back to the user. 

When Marfeel premium partners activate the Marfeel CDN Package, they might have questions regarding how their cache-control header strategies are treated. The following are the most common questions our premium partners have and the answers to those questions:

1) How does the Marfeel CDN Package impact a publisher's cache-control headers?

Marfeel completely respects a publisher's cache-control headers.

With that being said, partners should avoid max-age values like no-cache and must-revalidate as this instructs the CDN not to cache the resource and impact performance by forcing round trips to the origin.

In addition, values should be adjusted according to a publisher's needs. For example:

  • If a publisher wants the content to be updated frequently, a value greater than 60 seconds (max-age:60) is not ideal.
  • If a publisher has a JavaScript file that changes 2 times a year, a bigger max-age value like 1 month makes more sense.
  • If a publisher puts a value of max-age=3600 and then changes it to max-age=60, the resource will still be cached for 3600 seconds and the second value will only kick in when those 3600 seconds expire. 

2) If a publisher doesn't have cache-control headers, what are the default values Marfeel uses?

If the publisher has no cache-control headers, by default, Marfeel defines the following on their behalf:

  • Home page - 10 minutes and a stale if error of 1 hour
  • Images and fonts - 8 days
  • Everything else - 1 hour

To avoid edge cases where resources might not be updated, Marfeel applies the following limits to the values of cache-control:

  • HTML - 24 hours
  • CSS, JS, images, and fonts - 1 month
  • Everything else - 8 days

For more details regarding specific values, see the Marfeel CDN Package - Cache-Control Header Values article.  

3) What is considered a standard cache strategy in digital publishing?

For pages that are updated frequently, a max-age of 60 is recommended.

Other resources and their corresponding values depend on a publisher's needs. 

For more information regarding recommendations for cache-control headers and their explanations, see Google's HTTP Caching article.

4) Does a lower cache-control header impact performance and page rendering?

Yes, however it depends on the resource. 

When a TTL (time to live) expires, the cached content is not served anymore from the CDN and the request needs to go to the origin to retrieve the content. Therefore, having lower values for cache-control headers increase the number of requests to the origin which can delay page rendering. 

Marfeel minimizes this by honoring the header stale-while-revalidate which serves the "old" content after the max-age has expired, refreshing it in the background by making a round trip to the server for the new content so UX and performance is optimal. But even with a good stale-while-revalidate strategy, the misuse of lower cache-control headers can increase the number of requests to the origin and impact performance.