undefinedfix
Sign in

How to prevent users from accessing the cache when the front end file is updated to the server

racoleman edited in Fri, 10 Jun 2022

Today, the front-end file is updated to online build, and the file format generated after compilation is like this

clipboard.png

I'll delete the online ones and upload them. When I open the mobile phone to visit the website, I find that the JS file of the previous version is still read. Because it has been deleted by me, it can't be loaded. How can I prevent users from reading the cache every time the version is updated?

3 Replies
gallowayohio
commented on Fri, 10 Jun 2022

There is a cache because index.html The resulting cache is not a request after these JS files index.html We added a hash value to solve the problem

Nahuel
commented on Fri, 10 Jun 2022

Or it can be configured in nginx without caching

location ~.*\.(js|css|html|png|jpg)$
{
    add_header Cache-Control no-cache;
}
TalesMGodois
commented on Fri, 10 Jun 2022

Request timestamp

lock This question has been locked and the reply function has been disabled.