我有一个asp.net网站,默认情况下在头部发送以下缓存:
Cache-Control: private
我想将Cache-Control更改为:
no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
然而,当我在web.config中添加以下内容时:
<system.webServer>
<httpProtocol>
<customHeaders>
<remove name="Cache-Control" />
<remove name="Pragma" />
<remove name="Expires" />
<add name="Cache-Control" value="no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0" />
<add name="Pragma" value="no-cache" />
<add name="Expires" value="0" />
</customHeaders>
</httpProtocol>
</system.webServer>
它仍然会在Cache-Control头中向客户端发送“private”字符串:
Cache-Control
private,no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
您可以注意到它甚至在“private”后面没有留下空格,仍然将其添加到响应的开头。我如何使用web.config从Cache-Control中删除“private”?谢谢。