I am trying to write HSTS rewrite rules in the <system.webServer> section of the web.config file
<rewrite>
<rules>
<rule name="HTTP to HTTPS redirect" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^test\.test\.test$" ignoreCase="true" />
</conditions>
<action type="Redirect" url="https://test.test.test/{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; includeSubDomains; preload" />
</rule>
</outboundRules>
</rewrite>
I can see these redirect and rewrite rules in IIS but not sure why Strict-Transport-Security header is not present while checking via Dev tools F12 also the website is fully functional
I know there is another way to add custom headers in web.config but by looking into couples of posts here on SO, it doesn't look like a recommended approach.
Can anyone tell me what wrong am I doing here ?
