首页 > 编程知识 正文

vue打包后上传服务器有缓存,vuestore的缓存数据

时间:2023-05-04 18:12:56 阅读:198416 作者:3981

部署后进入使用ctrl+F5清除浏览器缓存,可以解决
如果不想使用ctrl+F5j解决的话可以考虑以下解决方案:

1、在vue项目中解决
在入口文件index.html添加:

<meta http-equiv="pragram" content="no-cache"><meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate"><meta http-equiv="expires" content="0">

2、如果是部署在nginx上
在nginx的配置文件 nginx.config添加:

location = /index.html { add_header Cache-Control "no-cache, no-store";}

如果是用nginx做反向代理的,这么加

location = /xx(xx为你的代理的项目名) { add_header Cache-Control "no-cache, no-store";}

如果nginx上有 proxy_cache 的配置,也考虑删掉,这是nginx的服务器缓存

nginx服务器缓存机制解析

https://blog.csdn.net/u013032097/article/details/91435268

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。