【发布时间】:2018-08-01 01:21:52
【问题描述】:
我有一个返回图像的 API,例如:
/api/products/images/233 -> 这将返回一个 233.jpg 图片
但是我的 IIS 有一条规则可以将 X-Content-Type-Options 标头添加到安全请求中,但这会破坏 Internet Explorer 上的图像,因此我需要一种方法来在端点 /products/ 时删除此规则images/ 仅在不是那个端点时才被调用或添加标头的方法。
我尝试使用这个关于Custom Headers
但是没用,我试过这样:
<system.webServer>
<rewrite>
<outboundRules>
<rule name="Remove nosniff">
<match serverVariable="RESPONSE_X_Content_Type_Options" pattern="/products/images/" />
<action type="Rewrite" value="none"/>
</rule>
</outboundRules>
</rewrite>
</system.webServer>
但它并没有改变任何东西,图像仍然有“nosniff”标题。
我是否缺少一些配置?还是有其他方法可以做到这一点?
【问题讨论】:
标签: iis