Prevent cached CSS & JS from becoming stale Print

  • magento 2, deploy, version, string, sign, static, content
  • 1

It's recommended for performance and bandwidth reasons to set long expiry times on static website assets. This includes images, CSS, JS and other media that is frequently included on different pages of your website.

By default, all our managed servers are configured to set a browser local cache time of at least 30 days. Unfortunately, this means when you make any direct on-server changes to such files, the end user's web browser will use the local cached copy and the changes will not display.

Fortunately, Magento 2 includes the ability to version-sign static files so that the URL paths are updated every time new changes are deployed.

To activate this setting, please log in to your Magento 2 admin area and then navigate to:
Stores > Settings > Configuration > Advanced > Developer > Static Files Settings

Once set, you will need to redeploy the static content and then refresh caches to ensure your assets are given a version string.


Was this answer helpful?

« Back