【问题标题】:How to clear cached javascript files using chrome as browser and nginx as webserver如何使用 chrome 作为浏览器和 nginx 作为网络服务器清除缓存的 javascript 文件
【发布时间】:2013-11-24 21:15:07
【问题描述】:

我正在 localhost 运行以下code

发生的情况是我的浏览器/服务器似乎将过时的 javascript 文件缓存在 js 文件夹中。

我已清除浏览器缓存并在 devtools 开启时启用禁用缓存。 但是 app.js 仍然是过时的副本。

我应该对 nginx 服务器做些什么吗?

【问题讨论】:

    标签: google-chrome angularjs caching nginx


    【解决方案1】:

    我终于知道为什么了。

    我正在使用 VirtualBox,我需要关闭 sendfile 配置。

    更多详情请参见: Prevent VirtualBox Guest from Delivering Cached Files

    只需确保 /etc/nginx/sites-available 中的相关 conf 文件您明确说明

    sendfile off;
    

    【讨论】:

      【解决方案2】:

      尝试设置过期-1;在 js 文件的 nginx 位置规则中。

      【讨论】:

      • 我对这个答案感到惊讶。有必要吗?
      猜你喜欢
      • 2017-08-26
      • 1970-01-01
      • 2011-02-04
      • 2017-07-20
      • 2021-05-05
      • 1970-01-01
      • 2011-05-08
      • 1970-01-01
      • 2015-02-18
      相关资源
      最近更新 更多