How to use a cache buster on resources with Neos Flow and Flowpack CacheBuster

Have you encountered that changes in your CSS, JS or images are not displayed in your application?

The webserver (or your browser – GRRR 😬) love to save and return the cached version of your static assets. In most cases because of HTTP Headers on the server (cache-control, max-age etc) and solely to help your users with a fast response.

But.. To avoid this, you can add a cache buster parameter to your static assets.

With the PHP Framework Flow it can be added by installation the package Flowpack CacheBuster package with composer

composer require flowpack/cachebuster

This will take your URI for you assets from this

http://localhost:8081/_Resources/Static/Packages/Vednor.Assets/Ui/application.js

to this

http://localhost:8081/_Resources/Static/Packages/Vednor.Assets/Ui/application.js?bust=153ca6ef

Notice the added ?bust=[string] – that make the URI somewhat unique depending on the content of the file.

Leave a Reply

Your email address will not be published. Required fields are marked *