我有一个多租户门户系统,但重写规则在多个条件下不起作用
<rule name="HTTP to HTTPS redirect" stopProcessing="true">
<match url="^(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
<add input="{HTTPS1}" pattern="^(website1\.com|www\.website1\.com)$" />
<add input="{HTTPS2}" pattern="^(website2\.com|www\.website2\.com)$" />
<add input="{HTTPS3}" pattern="^(website3\.com|www\.website3\.com)$" />
<add input="{HTTPS4}" pattern="^(website4\.com|www\.website4\.com)$" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="https://{HTTP_HOST}/{R:1}" />
</rule>我希望当我在webs浏览器上访问http://portal.website1.com时,该程序会将我带到https://portal.website1.com,并对portal.website2.com、portal.website3.com、portal.website4.com执行相同的操作
但它只适用于portal.website2.com和portal.website3.com,不强制portal.website1.com和portal.website4.com使用https
发布于 2019-06-04 22:45:02
在system.WebServer中尝试:
<system.webServer>
....
<rewrite>
<rules>
<rule name="Force HTTPS" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
<match url="*" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URO}" redirectType="Temporary" />
</rule>
</rules>
</rewrite>
</system.webServer>https://stackoverflow.com/questions/56427772
复制相似问题