2014-10-06 2 views
10

HTTPS 연결을 강제하는 URL 다시 쓰기 규칙을 작성하려고합니다. 요청이 로컬 호스트 (예 : http://localhost/mysite)를 사용하는 경우를 제외하고 항상 발생합니다. IIS URL localhost를 무시하는 https 규칙 다시 작성

규칙

은 다음과 같이 구성되어 있습니다 :

<rule name="Redirect to https" enabled="true" stopProcessing="true"> 
     <match url="(.*)" negate="false" /> 
     <conditions trackAllCaptures="false"> 
      <add input="{HTTPS}" pattern="^OFF$" /> 
      <add input="{URL}" pattern="localhost" negate="true" /> 
     </conditions> 
     <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" /> 
</rule> 

나는 또한 아무 도움으로 URL 조건에 대한 패턴으로^^ localhost를 /(.*) 로컬 호스트와를 사용했습니다. 이것이 작동하지 않는 이유와이 문제에 대한 해결책이 누구에게 있습니까?

+0

어떤 버전과 같아야? 질문을 업데이트 할 수 있습니다. – kkuilla

+0

지금 IIS8에서 사용하고 있습니다. 그러나 이미 솔루션을 제공했습니다. 고마워. –

답변

22

코드는 IIS의 대신이

<rule name="Redirect to https" enabled="true" stopProcessing="true"> 
    <match url="(.*)" /> 
    <conditions logicalGrouping="MatchAll" trackAllCaptures="false"> 
     <add input="{HTTPS}" pattern="off" /> 
     <add input="{HTTP_HOST}" pattern="localhost" negate="true" /> 
    </conditions> 
    <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" /> 
</rule> 
+1

당신은 남자입니다! 고마워요! –