質問

質問

ウェブサイトをスキャンするhttps://observatory.mozilla.org次のエラーが発生します:httpからhttpsへの最初のリダイレクトは別のホストに行われるため、HSTSが防止されます。

質問

  • これは私の設定に本当に問題があるのでしょうか、それともサブドメインが同じドメインの一部であると認識されないツールのバグなのでしょうか?
  • 以下の追加情報に基づいて、私が見逃している可能性があるものを誰かアドバイスしてもらえますか?

詳細

このサイトのドメインは Google Domains に登録されています。このサイトにアクセスするユーザーがexample.com自動的にリダイレクトされるように、www.example.com次のルールでサブドメイン転送を設定しました。

example.com → https://www.example.com 
Permanent redirect (301), Forward path

さらに、私は(asp.net)サイト内に、web.configHTTP接続をHTTPSにリダイレクトし、Strict-Transport-SecurityHTTPヘッダーを追加するルールを設定しています(有名なスコット・ハンセルマンのブログのアドバイス):

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <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>
            </rules>
            <outboundRules>
                <rule name="Add Strict-Transport-Security when HTTPS" enabled="true">
                    <match serverVariable="RESPONSE_Strict_Transport_Security" pattern=".*" />
                    <conditions>
                        <add input="{HTTPS}" pattern="on" ignoreCase="true" />
                    </conditions>
                    <action type="Rewrite" value="max-age=63072000; includeSubDomains; preload" />
                </rule>
            </outboundRules>
        </rewrite>
        <httpProtocol>
            <customHeaders>
                <remove name="X-Powered-By" />
                <!-- add name="Strict-Transport-Security" value="max-age=63072000; includeSubDomains; preload" / -->
                <add name="Content-Security-Policy" value="default-src 'self';" />
                <add name="X-Content-Type-Options" value="nosniff" />
                <add name="X-Frame-Options" value="DENY" />
                <add name="X-Xss-Protection" value="1; mode=block" />
            </customHeaders>
        </httpProtocol>
    </system.webServer>
</configuration>

サイト自体は Azure でホストされています (Visual Studio サブスクリプションの無料クレジットを使用)。ここでのサイトの URL は で、Google Domains ではをexample.azurewebsites.net指す CName があります(カスタム リソース レコードの下)。wwwexample.azurewebsites.net

関連情報