0

I have activated the minify and merged option for the CSS and JS files for better site performance, but recently I have had problems, after deploying and cleaning cache in both varnish and the application, the files do not take the changes I have made.

I have tried clearing cache also in the application with:

enter image description here

But it does not take the changes either, I am sure it is some cache, because when I go directly to the URL of the static CSS file (/static/frontend/Vendor/default/es_CO/css/styles-l.min.css) changes are not reflected, and when I edit the URL with ? for example (/static/frontend/Vendor/default/es_CO/css/styles-l.min.css?asdasasassdasdasd) changes are reflected in the file.

Has anyone had the same error or problems with the cache in minify and merged files?

Magento version 2.3.5

1 Answer 1

2

If adding a query string to the request effectively busts the cache, then you are probably dealing with some sort of CDN like Cloudflare or a reverse proxy cache like Varnish or Fastly.

Try purging the URL from any CDN or reverse proxy caches that you may be using.

Also, it should be noted that to effectively use minification and merging, your site should be in production operation mode. Your current URL format looks like it is not in production mode. If it were, it would start with a version prefix, like /static/version1693419980/, which would serve to automatically bust any proxy or CDN caches from previous deployments. You can check your current operation mode with the following CLI command:

bin/magento deploy:mode:show

To switch to production operation mode, use the following command. Note, this command will put the site into maintenance mode while interceptor proxy classes are generated and static assets are copied, merged and minified:

bin/magento deploy:mode:set production

Once you are in production mode, you will need to deploy new versions with a series of commands such as bin/magento setup:di:compile and bin/magento setup:static-content:deploy. See the official documentation about Deployment Flow for more details. That documentation is actually part of a larger performance best practices guide that you may be interested in.

1
  • Thanks, When I read 'versions of the urls' I realized that I am in production mode, but that I needed to activate an option to be able to create them, for those who have the same problem, the Static Files Settings option must be activated and then deploy the static content again, and clear the application cache. With this we can have minified versions of our urls and avoid cache problems. Thanks for your help, it works great. Commented Sep 18, 2023 at 17:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.