Update browser cache when publishing new version (without CTRL+F5)



  • Hi there,

    First of all, thank you very much for creating such an amazing framework! I deployed an awesome website, and I am having a lot of fun with it.

    I have a question: Whenever I publish a new version of the site, the users still see the old site because it is cached in their browser.

    Is there a way to instruct quasar to create version numbers when referencing each chunk file (i.e. chunk.js?v=###hash). This usually forces the browser to reload the resources. I know each chunk is named with a hash, but somehow this doesn’t force chrome to reload resources (I have to tell users to CTRL+F5).

    I searched the form for this solution, but the answers were from 2017, and don’t apply.

    Thanks!!
    Pavel



  • You can make a PWA that auto updates itself. The Quasar website( made in quasar) does the same.



  • Thanks for your reply, but we don’t need PWA currently. anyone else have any ideas?



  • I figured it out. I tried setting the <meta tags, but it never works.
    It seems the issue is with the server setting cache headings. I made a change to the nginx sites-available file:

        location / {
                try_files $uri $uri/ =404;
                add_header Cache-Control "no-store, no-cache, must-revalidate";
        }
    
        location /static {
                expires 30d;
                add_header Cache-Control "public";
                access_log off;
        }


  • @apavel very useful!


Log in to reply