2017-08-04 103 views
0

我有以下重定向規則將所有http請求重定向到https。將www重定向到非www https https在彈性beanstalk中的IIS

<rule name="Force Https" stopProcessing="true"> 
     <match url="healthcheck.html" negate="true" /> 
     <conditions> 
     <add input="{HTTP_X_FORWARDED_PROTO}" pattern="https" negate="true" /> 
     </conditions> 
     <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" /> 
    </rule> 

我想這個規則到所有www流量重定向到non www https爲好。 該應用程序被部署到負載平衡的EBS環境中。

讓我知道是否需要其他信息。謝謝你的時間。

回答

0

我在web.config文件中增加了另一個規則。以下是密碼

<rule name="Remove www" stopProcessing="true"> 
     <match url="^(.*)$" ignoreCase="false" /> 
     <conditions logicalGrouping="MatchAll"> 
     <add input="{HTTP_HOST}" pattern="^www\.(.+)$" /> 
     </conditions> 
     <action type="Redirect" url="https://{C:1}/{R:1}" redirectType="Permanent" /> 
    </rule> 

    <rule name="Force Https" stopProcessing="true"> 
     <match url="healthcheck.html" negate="true" /> 
     <conditions> 
     <add input="{HTTP_X_FORWARDED_PROTO}" pattern="https" negate="true" /> 
     </conditions> 
     <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" /> 
    </rule> 
相關問題