【发布时间】:2017-12-08 07:18:44
【问题描述】:
我想启用严格的传输安全性。 我的网站是一个 https 启用。 下面是我启用 hsts 的代码。
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="X-Frame-Options" value="SAMEORIGIN" />
**<add name="Strict-Transport-Security" value="max-age=31536000"/>**
.....
</customHeaders>
</httpProtocol>
以上设置足以启用严格的传输安全性还是我还需要添加以下设置。
<rewrite>
<rules>
<rule name="HTTP to HTTPS redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}"
redirectType="Permanent" />
</rule>
</rules>
<outboundRules>
<rule name="Add Strict-Transport-Security when HTTPS" enabled="true">
<match serverVariable="RESPONSE_Strict_Transport_Security"
pattern=".*" />
<conditions>
<add input="{HTTPS}" pattern="on" ignoreCase="true" />
</conditions>
<action type="Rewrite" value="max-age=31536000" />
</rule>
</outboundRules>
</rewrite>
如果这两个设置都是强制性的,那么重写的需要是什么 我们只能通过启用 hsts 或仅 重写。
为什么需要重写。
This site 说要添加 rewrite alogn with
<add name="Strict-Transport-Security" value="max-age=31536000"/>
【问题讨论】:
标签: asp.net-mvc security iis-7