Picto thématique

Rule n° 220 - The server sends information to enable the caching of contents

A server can accompany the sending of an HTML page or an image, Java- Script, CSS or other file, as well as information allowing them to be cached on the user workstation. To do this, it is necessary to configure it correctly, and everyone wins.

#Eco-conception #Server and performance #Development

Goal

  • Speed up the display of content and enable a smoother navigation experience.
  • Reduce bandwidth costs.

Implementation

Configure the web server so that it can manage the caching of static elements and manage, at the application level, the possible caching of dynamic elements.

In practice, and in accordance with the HTTP specifications, the server must send the corresponding etag, date and last-modified headers, to the identifier of the resource, to the date of processing of the request and to the date of the last modification, respectively, of the requested resource. All dates are in GMT format. This information can be supplemented by the content-length and expires fields if the size in bytes and the exact expiry date of the content are known.

In order to inform the proxies and the end clients about the behaviour to adopt in relation to cached content, developers should use the HTTP cache-control header in accordance with the necessary refresh times and the privacy of the delivery.

Possible caching can be finalised by submitting a 304 Not Modified message (without the requested resource in the request body), when the server receives an if-modified-since header containing a date prior to the modification date of the resource.

Control

For each page: check the possible caching of the page elements using a dedicated tool (development tools, online service, etc.) Be careful to check all of the linked elements (CSS, JS, images) and not just the page itself.

By Opquast - Read the license

Business application and benefits

The rules should be applied to your projects from the design phase through to post-implementation , and they should be understood by all professionals with web and customer experience (CX) responsibilities: from strategy to operations, marketers to project managers, and editorial to technical staff. The benefits of using this ruleset are numerous, including improving customer satisfaction, web performance, and e-commerce, and expanding your client base, while also decreasing your errors and costs.

Multidisciplinary verticles - accessiiblity, SEO, e-commerce, ecodesign etc..- starting from the foundational Opquast base.

The objective of these rules and the Opquast community mission is ‘making the web better’ for your customers and for everyone! Opquast rules cover the key major areas of risk that can negatively affect website users such as privacy, ecodesign, accessibility and security.

Opquast training has already allowed over 11,000 web professionals to have their skills certified. Train your teams or your students, contact us