问题描述
我有一个带有SPA的SPA,可以从IIS服务,并且想要添加一些缓存策略,如针对Google性能分析所建议的那样,我的问题是我那里已经有一些重写规则,并且当我将它们与staticContent放在一起时clientCache的,程序失败。我还没有同时找到两个示例,文档还没有一个。
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Static Assets" stopProcessing="true">
<match url="([\S]+[.](html|htm|svg|js|css|png|gif|jpg|jpeg))" />
<action type="Rewrite" url="/{R:1}"/>
</rule>
<rule name="ReactRouter Routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="/index.html" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
这就是我需要添加的内容:https://docs.microsoft.com/en-us/iis/configuration/system.webserver/staticcontent/clientcache
有人知道怎么做吗?有人有例子吗?
注意:我也尝试过使用routes.json:
{
"routes": [],"defaultHeaders": {
"cache-control": "must-revalidate,max-age=6000"
}
}
但是也没有任何运气。 预先感谢
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)