【发布时间】:2015-03-10 18:25:43
【问题描述】:
我已在我的云服务的生产槽上设置了 SSL。在我的 Web.Release.config 中,我有一个从 http 重定向到 https 的规则。我使用 Release 配置部署到登台,这样当我与生产交换时,重定向就会发生。但是,这会导致我的 staging 重定向到生产环境,这意味着我永远无法真正测试我的 staging 部署(基本上我可以测试重定向是否正在发生)。
我觉得这个设置是错误的。有人知道我的设置是否不正确吗?
编辑:Web.Release.config 规则:
<system.webServer>
<rewrite xdt:Transform="Insert">
<rules>
<rule name="CanonicalHostNameRule1">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www\.myDomain\.com$" negate="true" />
</conditions>
<action type="Redirect" url="http://www.myDomaim.com/{R:1}" />
</rule>
<rule name="http to https" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="SeeOther" />
</rule>
</rules>
</rewrite>
</system.webServer>
EDIT 2 我最终采用了@BenV 的方法来确保重定向规则与我的暂存槽的 URL 不匹配。有道理:D
【问题讨论】:
-
你的规则是什么样的?
-
@kwill 添加配置规则