将azure webapp从非www重写为www

时间:2015-12-01 18:15:19

标签: azure iis

我想用https://www.example.com重写任何Url。它使用以下配置,但是当我发出请求时 https://example.com它失败了。

curl -H 'Content-type: application/json' -d '{"name": "ALL_MODE_INDC","stored": true,"indexed": true,"field_type": "string" ,"default_value":"N"}' http://<solrServer>:<solrIP>/api/collections/ALGORITHM_AU_TEST/fields

1 个答案:

答案 0 :(得分:0)

使用两个规则,一个用于HTTPS,也用于规范重定向:

<rule name="Redirect to HTTPS" stopProcessing="false" xdt:Transform="Insert">
  <match url="(.*)" />
  <conditions>
    <add input="{HTTPS}" pattern="^OFF$" />
  </conditions>
  <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
</rule>
<rule name="Canonical Host Name" stopProcessing="false" xdt:Transform="Insert">
  <match url="(.*)" />
  <conditions>
    <add input="{HTTP_HOST}" negate="true" pattern="^(www\.example\.com)$" />
  </conditions>
  <action type="Redirect" url="https://www.example.com/{R:1}" redirectType="Permanent" />
</rule>