2014-02-14 4 views
3

http를 https로 리디렉션하는 표준 iis url 재 작성 모듈 기술을 사용하면 iisnode와 작동하지 않습니다.URL iisnode에서 https로 http를 다시 작성합니다.

나는 다음과 같은 규칙을 구성 http를 https로 리디렉션하는 데 :

<rule name="HTTP to Prod HTTPS redirect" stopProcessing="true"> 
    <match url="(.*)" /> 
    <conditions> 
    <add input="{HTTPS}" pattern="off" ignoreCase="true" /> 
    </conditions> 
    <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" /> 
</rule> 

문제 것은 http://domain.net를 요청하는 것은 "서버를 제거하는 방법을 https://domain.net/server.js

어떤 아이디어로 재이다 .js "URL의 일부입니까?

답변

4

좋아, 해결책은 간단합니다. HTTP 상단에 HTTP -> HTTPS URL 재 작성 규칙을 넣으면됩니다. 최종 구성은 다음과 같습니다.

<rewrite> 
    <rules> 
    <rule name="HTTP to Prod HTTPS redirect" stopProcessing="true"> 
     <match url="(.*)" /> 
     <conditions> 
     <add input="{HTTPS}" pattern="off" ignoreCase="true" /> 
     </conditions> 
     <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" /> 
    </rule> 
    <!-- Don't interfere with requests for logs --> 
    <rule name="LogFile" patternSyntax="ECMAScript" stopProcessing="true"> 
     <match url="^[a-zA-Z0-9_\-]+\.js\.logs\/\d+\.txt$" /> 
    </rule> 
    <!-- Don't interfere with requests for node-inspector debugging --> 
    <rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true"> 
     <match url="^server.js\/debug[\/]?" /> 
    </rule> 
    <!-- First we consider whether the incoming URL matches a physical file in the  /public folder --> 
    <rule name="StaticContent"> 
     <action type="Rewrite" url="public{REQUEST_URI}" /> 
    </rule> 
    <!-- All other URLs are mapped to the Node.js application entry point --> 
    <rule name="DynamicContent"> 
     <conditions> 
     <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True" /> 
     </conditions> 
     <action type="Rewrite" url="server.js" /> 
    </rule> 
    </rules> 
</rewrite>