2016-08-05 11 views
0

私はASP.NET Webformsアプリケーションを持っており、NWebsecを使用しています。それは意図どおりに動作しますが、HTTPSを最初からHSTSで要求した後ではなく、強制的に開始しようとしています。 URLリライトを追加すると、リダイレクトループに入ります。 NWebsecとURLリライトを削除すると正常に動作します。どちらの場合でもNWebsecは動作しますが、HTTPを読み込むと書き換えがなければ、HTTPSは強制されません。 upgrade-insecure-requestsはそれ自身では動作しません。NWebsecとURL書き換えの競合

URLの書き換えルール

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

NWebsecコンフィグ

<nwebsec> 
    <httpHeaderSecurityModule xmlns="http://nwebsec.com/HttpHeaderSecurityModuleConfig.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="NWebsecConfig/HttpHeaderSecurityModuleConfig.xsd"> 
    <redirectValidation enabled="true" /> 
     <setNoCacheHttpHeaders enabled="true" /> 
     <x-Robots-Tag enabled="false" noIndex="false" noFollow="false" noArchive="false" noOdp="false" noSnippet="false" noImageIndex="false" noTranslate="false" /> 
     <securityHttpHeaders> 
     <x-Frame-Options policy="Deny" /> 
     <strict-Transport-Security max-age="60" includeSubdomains="true" httpsOnly="true" preload="false" /> 
     <x-Content-Type-Options enabled="true" /> 
     <x-Download-Options enabled="false" /> 
     <x-XSS-Protection policy="Disabled" blockMode="true" /> 
     <content-Security-Policy enabled="true"> 
      <upgrade-insecure-requests enabled="true" /> 
     </content-Security-Policy> 
     </securityHttpHeaders> 
    </httpHeaderSecurityModule> 
</nwebsec> 

答えて

0

PEBKAC、問題を発見しました。 documentationをよく読んでください。

<redirectValidation enabled="true"> 
    <allowSameHostRedirectsToHttps enabled="true" /> 
</redirectValidation>