One of the most common ways of improving the speed of your site is caching.
However, when it comes to updating static files on the server, caching can have its limitations. In fact, the browser will only retrieve file updates from the server very occasionally, or if your user manually clears the cache. As a result, the browser will potentially use both old and new files, which can cause the web page to display incorrectly. This is a real problem when you want to update your content.
To remedy the problem, URL versioning addresses this caching limitation.
What is URL versioning?
URL versioning is a webperf best practice – which our engine enables you to apply – that involves modifying only the names of static files. More precisely, our engine adds a version number to each URL of a static object so that it can be stored longer in caches (browser, CDN, proxies).
For example, in the case of a file initially named logo.png, we rename it logo.png?frz-v=2
By automatically changing the name of the static file, the browser will no longer search for the logo.png file, but will retrieve the new logo.png?frz-v=2 file.
Objective: to enable users to access the latest version of all site files without having to clear their cache.
What’s the impact?
URL versioning has many advantages. It enables :
- preserve the caching system, which is an essential webperf best practice: the browser no longer needs to retrieve information from your server, it has already memorized it and can respond more quickly to your visitors’ requests;
- avoid inconsistencies in the loading of an updated site;
- avoid having to clear the cache of each CDN via each of the APIs, in the case of a multi-CDN. Old and new versions of static files are always stored, but only the new one is displayed.
Note that there are two ways to apply URL versioning:
- change the URL parameter: logo.png becomes logo.png ?frz-v2
- change the file name: logo.png becomes logo1.png
In the past, some tools may have advised you to change the file name rather than the URL parameter, on the pretext that some cache servers do not take parameter changes into account. However, this is no longer a problem, as changing the URL parameter is now taken into account by all cache servers and browsers.
If you’d like to find out more about the webperf best practices that our engine can automate, and the benefits you could gain for your loading times :