You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何仅在特定IIS应用中禁止Microsoft Edge缓存publish.htm文件

问题1:分别部署配置到子文件夹是否可行

完全可行。
每个子文件夹下的web.config只会作用于当前目录范围内的资源,你写的path="publish.htm"会精准匹配当前目录下的同名文件,给响应头添加Cache-Control: no-cache指令,完全可以实现禁止Edge缓存这些publish.htm的需求。

问题2:是否可以统一在foo目录配置匹配所有目标文件

可以,不需要每个子文件夹单独放配置,维护更方便。
只需要将foo目录下web.config的location节点path属性改为**/publish.htm即可,这个通配符规则会匹配foo目录下所有层级子目录中名为publish.htm的文件,后续新增子目录也不需要额外调整配置。

你也可以优化下Cache-Control的取值,规则更稳妥,彻底避免Edge缓存旧版本:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <location path="**/publish.htm">
    <system.webServer>
      <httpProtocol>
        <customHeaders>
          <add name="Cache-Control" value="no-cache, no-store, must-revalidate" />
        </customHeaders>
      </httpProtocol>
    </system.webServer>
  </location>
</configuration>

以上配置在Edge v92及以上版本完全兼容,适配你的使用场景。

内容的提问来源于stack exchange,提问作者Tim

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.01 05:27:02