RESPONSE_Strict_Transport_Security Server Variable for Enforcing SSL in IIS

So, I saw this solution ( http://www.hanselman.com/blog/HowToEnableHTTPStrictTransportSecurityHSTSInIIS7.aspx ) used in other answers and other sites, but I don’t understand HOW the HSTS header is added. I guess it has a lot to do with this:

<match serverVariable="RESPONSE_Strict_Transport_Security" pattern=".*" />

Can someone explain where "RESPONSE_Strict_Transport_Security" comes from?

Full code:

<?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=31536000" />
                </rule>
            </outboundRules>
        </rewrite>
    </system.webServer>
</configuration>
+4
source share
1 answer

, , "RESPONSE_Strict_Transport_Security" " " , "RESPONSE_Expect_Staple" "-".

, , , .

https://docs.microsoft.com/en-us/iis/extensions/url-rewrite-module/modifying-http-response-headers

0

Source: https://habr.com/ru/post/1670118/


All Articles