我正在尝试在 Rackspace 云站点中使用 [RequireHttps],但是当我点击任何使用该属性的操作时,我只是收到一条重定向循环消息。我和支持人员谈过,但他们帮不上什么忙。有没有人让 [RequireHttps] 在 rackspace 云站点上的 MVC 3 站点中工作?
最佳答案
我遇到了同样的问题。我终于在 Rackspace 的网站上找到了一篇知识库文章。
web.config 选项工作正常,只需确保从您的代码中删除 [RequireHttps] 属性(不需要)。
为了简单起见,我将其复制在下面。
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect to HTTPS" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_CLUSTER_HTTPS}" pattern="^on$" negate="true" />
<add input="{HTTP_CLUSTER_HTTPS}" pattern=".+" negate="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{SCRIPT_NAME}" redirectType="SeeOther" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
关于asp.net-mvc-3 - 你如何在 Rackspace 云站点中使用 [RequireHttps],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9963479/