0
我发现了两个不同的重写规则来为IIS托管的网站强制使用HTTPS。我有一个网站将托管在Azure应用服务上,该服务将使用此规则。IIS重写规则
选项1:
<rewrite>
<rules>
<rule name="Force HTTPS" enabled="true">
<match url="(.*)" ignoreCase="false" />
<conditions>
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
选项2:
<rewrite>
<rules>
<rule name="Redirect to https">
<match url="(.*)"/>
<conditions>
<add input="{HTTPS}" pattern="Off"/>
<add input="{REQUEST_METHOD}" pattern="^get$|^head$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent"/>
</rule>
</rules>
</rewrite>
问题:
- 时哪些IGNORECASE的原因设置为false选项1?
- REQUEST_METHOD输入是否将选项2中的安全性限制为GET和HEAD?
- appendQueryString =“true”是否使查询字符串保持重定向?
- 是否有任何其他选项可以考虑不属于这两者之一?
感谢您的链接。对REQUEST_METHOD条件的作用有什么想法?它似乎限制了重定向到GET和HEAD请求。 – Josh
是Http_Method的限制(只有在http_method为get头时重定向),我认为第一个选项更好。 – aloji