# Validate content freshness

Freshness for a resource refers to how up-to-date it is. The freshest content is an exact mirror of what a tenant has on their servers, while stale content is outdated.

This article describes helps you identify if a resource is fresh or stale.

# Last modification date

Given outdated content, first check the x-mrf-lastmod header. In it we will find the resource's last update time.

TIP

The x-mrf-lastmod header is added by Gutenberg when serving resources. As a consequence, it is not available for Desktop content and static resources, that do not go through Gutenberg.

  1. Use Google Chrome's Network Activity tab (opens new window) to inspect the response headers of a request.
  2. Simulate a mobile device to get the marfeelized version of the resource. e.g. iPhone X
  3. Use incognito to avoid hitting your browser's cache

# Check the resource in production environment

  1. Open the network tab and find the resource to inspect.

  2. Find the x-mrf-lastmod value: For example for a homepage, filter with the resource type "doc": lastmod response header in chrome

  3. Use a date converter (opens new window) to translate it from Unix timestamp: 1589270679301 in Unix timestamp is Tue May 12 2020 08:04:39

There are two possible results from this check:

  • Content is fresh: if the last modification date is after the issue you are investigating, it might have solved itself. There could have been an invalidation delay, the browser cache...
  • Content is not fresh: if the last modification date is too far in the past (older than the last invalidation, or more than a day is a smell), continue to next step.

# Check the resource in liveint environment

Repeat the previous step in liveint environment, where Marfeel cache layers are ignored.

E.g. https://liveint.mrf.io/hub/origin/examplecontent.com/random-article/

There are two possible results from this check:

  • Content is fresh: if the last modification date is more recent than in the production environment, continue to next step.
  • Content is not fresh: if content is stale both in production and liveint, the resource is not being invalidated correctly. Read the invalidation Elastic Search index to identify the error.

# Check resource's max age

If content is "fresh" in liveint but does not propagate soon enough to the production version, you can check the maximum age of the resource with the cache-control: max age header.

Its value tells us when the content will be refreshed. If the max-age value is too high and should be changed, contact the Caching Systems Chapter.

If the content needs to be refreshed immediately, force a cache purge.

TIP

Check this article for more information on Fastly's Elastic Search index.