网址重写未重定向到https

时间:2014-11-07 06:25:59

标签: redirect asp.net-mvc-5 azure-web-sites

我的web.config中有一个url重写,应该将一些网址重定向到https,而忽略其他一些网址。

以下是我目前的情况:

<rewrite>
    <rules>
        <rule name="Redirect to HTTPS">
            <match url="(.*)" />
            <conditions>
              <add input="{HTTPS}" pattern="off" ignoreCase="true" />
              <add input="{HTTP_HOST}" pattern="localhost" negate="true" />
              <add input="{HTTP_HOST}" pattern="^.qa.mysite.com" negate="true" />
              <add input="{HTTP_HOST}" pattern="dev1.qa.mysite.com" negate="false" />
              <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            </conditions>
         <action type="Redirect" url="https://{SERVER_NAME}/{R:1}" redirectType="SeeOther" />
       </rule>
    </rules>
</rewrite>

我通过不重定向localhost和所有* .qa.mysite.com网址按预期工作。它还会按预期将dev1.qa.mysite.com重定向到https。

问题在于我希望dashboard.mysite.com能够自动重定向https,而我无法弄清楚如何使其工作。

如果我添加,

<add input="{HTTP_HOST}" pattern="dashboard.mysite.com" negate="false" />

,它不起作用。

知道我错过了什么吗?

0 个答案:

没有答案
相关问题