[英]HTTP to HTTPS Redirect Exception
我在MVC应用程序中使用HTTP到HTTPS重定向。
这是我在Web.config中使用的代码:
<rewrite>
<rules>
<rule name="HTTP to HTTPS redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}"/>
</rule>
</rules>
</rewrite>
我的应用程序中有一个页面无法在HTTPS上运行,因此我需要为此规则添加一个例外。
我想知道是否有人可以帮助我或者向我展示一些教程/示例。
您只需要添加另一个条件即可取消您的url规则。 您的新规则将如下所示:
<rule name="HTTP to HTTPS redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
<add input="{R:1}" pattern="myfolder\/myfile\.aspx" negate="true"/>
</conditions>
<action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}"/>
</rule>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.