Immutable cache

The cache of static files is one of the most important elements when it comes to managing a good cache, especially those files that can be considered immutable.

In general, an immutable file is one that does not change, and this does not always happen. To begin with, we could propose that in a WordPress the Media files that we upload to the panel are immutable, since when uploading a new file a new URL will be generated, and that URL will never change. I’m talking about image files, PDFs and the like.

For these cases, we should configure the cache header with the time we define, and with a specific label:

Cache-Control: public, max-age=86400, immutable

Keep in mind that not all browsers support this header, but if they do not support it and it is, nothing happens because it is ignored. You can see a reference of where it is supported.

The most useful case for this type of cache, in addition to the previous cases, is that of fingerprinted URLs, which are those URLs that may vary, but in that specific case, their content is always the same. An example is the cache URLs of CSS or JS that generate many “optimization” systems, creating files of the style a


This file has a control system (the part of abc123) that makes that content unique, and that if the content of the file changes, the name of the file also does.

This would help cache systems allow you to create immutable URLs.

About this document

This document is regulated by the EUPL v1.2 license, published in WP SysAdmin and created by Javier Casares. Please, if you use this content in your website, your presentation or any material you distribute, remember to mention this site or its author, and having to put the material you create under EUPL license.