Tutorials UPDATED: 29 October 2021

How Pressidium implements browser caching

Yorgos Fountis

3 min read
Image for How Pressidium implements browser caching

Previously, we delved into the browser cache and explained the various cache-related headers you can use in order to optimise your website and make it snappier. The HTTP protocol has gone through several iterations; HTTP/1.0 and 1.1 with each of those implementing their own set of browser caching headers. For example, HTTP/1.0 used the Expires keyword along with Pragma: no-cache directive to specify an exact “best by” date and to further instruct the browser not to cache anything if no caching was needed.

The different implementations, browsers, and server topology can quickly make browser caching a daunting task; but this is where we enter the picture.

Pressidium’s browser caching policy

We treat dynamic content differently from static content. Dynamic content is forced to be revalidated every time the browser requests it. This is only logical; if you cached dynamic content, then it wouldn’t be considered dynamic! This is implemented using the must-revalidate, max-age=0 directives in Cache-Control. This forces the browser to ask the server if the copy it has in its cache is the most recent one. However, max-age=0 forces the browser not to keep anything in its cache. These two directives effectively make sure that dynamic content is always fetched from the server, no matter what.

Cached static content on the other hand (such as images, CSS files, javascript, etc) is configured to be good for 30 days.

Additionally, we use the Expires keyword, strictly for backwards compatibility reasons; calculating its absolute value according to Cache-Control‘s max-age value. The Expires keyword takes an absolute value in the form of an expiration date, whereas the Cache-Control: max-age=n keyword specifies a relative value (n). This value specifies for how long the content can be considered fresh once it is cached.

HTTP/1.1 also introduced another header called Etag that works as a sort of “fingerprint” for content. Every content gets associated with an Etag value (which is generated by the web-server using a variety of ways). Whenever the content changes, the Etag value changes as well, thus, signalling the need for the browser to get a fresh copy. Etag is used in Pressidium only for static files, and it is generated using the file’s modification time and size. This simply means that the web-server generates a new Etag value every time the content is modified.

The implementation of a browser caching policy is something that you don’t need to fuss about if you’re a Pressidium client. Should you ever have questions related to browsing caching or experience any problems do not hesitate to contact us. We provide end-to-end support and we mean it.

Host your WordPress Website with Pressidium!

View our price plans


Building a CI/CD Workflow – Automatically Deploying a WordPress Theme with GitHub Actions

Streamline your WordPress deployment process using GitHub Actions and a CI/CD workflow. Automatically build and deploy a WordPress theme to your Pressidium WordPress site.
Konstantinos Pappas
Konstantinos Pappas
22 min read

Types of Cross-Site Scripting (XSS) Attacks

In this article, on XSS attacks we're going to deep dive cross-site scripting examples to better understand how these types of attacks work.
Tassos Antoniou
Tassos Antoniou
6 min read

5 Best Tips For Web Developers When Coding For eCommerce Websites

So how can you become a successful web developer when coding for ecommerce websites? Check out this article to find out!
Daryl Bush
Daryl Bush
7 min read

WordPress and Cross-Site Scripting (XSS)

Cross-site scripting (XSS) attacks are a common types of website attack seen across the internet. Find out how to protect your website!
Tassos Antoniou
Tassos Antoniou
7 min read