Azure IIS重写规则
我发现了两种不同的重写规则来强制IIS托管网站使用HTTPS。我有一个网站将托管在Azure应用程序服务上,该服务将使用此规则 备选案文1:Azure IIS重写规则,azure,iis,url-rewrite-module,Azure,Iis,Url Rewrite Module,我发现了两种不同的重写规则来强制IIS托管网站使用HTTPS。我有一个网站将托管在Azure应用程序服务上,该服务将使用此规则 备选案文1: <rewrite> <rules> <rule name="Force HTTPS" enabled="true"> <match url="(.*)" ignoreCase="false" /> <conditions> <add inp
<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–使用此属性控制条件的模式匹配应区分大小写还是不区分大小写
- appendQueryString–指定在替换过程中是否应保留当前URL中的查询字符串。默认情况下,如果未指定AppendQueryString标志,则假定该标志为TRUE。这意味着原始URL中的查询字符串将附加到替换的URL