IIS 缓存, 更新后前端资源不能更新问题

解决办法: 

通常只需要index.html 不缓存即可, 其他文件都是根据index.html 中的引用去加载;

正确的做法是在 站点下增加 web.config 文件, 内容如下:

我这个是因为目录下有个config.js 配置文件, 也不能缓存, 所以加了两个

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <location path="index.html">
        <system.webServer>
            <staticContent>
                <clientCache cacheControlMode="NoControl" />
            </staticContent>
            <httpProtocol>
                <customHeaders>
                    <add name="Cache-Control" value="no-store" />
                </customHeaders>
            </httpProtocol>
        </system.webServer>
    </location>
    <location path="config.js">
        <system.webServer>
            <staticContent>
                <clientCache cacheControlMode="NoControl" />
            </staticContent>
            <httpProtocol>
                <customHeaders>
                    <add name="Cache-Control" value="no-store" />
                </customHeaders>
            </httpProtocol>
        </system.webServer>
    </location>
</configuration>

效果: 

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-01-18 07:22:07       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-01-18 07:22:07       100 阅读
  3. 在Django里面运行非项目文件

    2024-01-18 07:22:07       82 阅读
  4. Python语言-面向对象

    2024-01-18 07:22:07       91 阅读

热门阅读

  1. 微软推出了Copilot Pro 每月20美金

    2024-01-18 07:22:07       56 阅读
  2. AWS Secrets Manager 实战指南

    2024-01-18 07:22:07       59 阅读
  3. 敲诈勒索该怎么办

    2024-01-18 07:22:07       51 阅读
  4. 汽车售后服务客户满意度调查报告

    2024-01-18 07:22:07       52 阅读
  5. Spring boot 常见注解

    2024-01-18 07:22:07       50 阅读
  6. ChatGPT 和 文心一言 的优缺点及需求和使用场景

    2024-01-18 07:22:07       48 阅读
  7. GitLab服务器忘记root密码处理方式

    2024-01-18 07:22:07       52 阅读
  8. 【VUE】点击按钮下载全部链接文件

    2024-01-18 07:22:07       56 阅读
  9. SpringBoot-01

    2024-01-18 07:22:07       47 阅读