Enable HSTS in server 2016 and IIS10 version 1607

Vindhya DS 1 Reputation point


Please help me to enable HSTS server 2016 and IIS 10 version 1607.I have tried adding the below code to web config but it is throwing error, I have attached web config and error

<rule name="HTTP to HTTPS redirect" stopProcessing="true">
<match url="(.)" />
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
<rule name="Add Strict-Transport-Security when HTTPS" enabled="true">
<match serverVariable="RESPONSE_Strict_Transport_Security" pattern=".
" />
<add input="{HTTPS}" pattern="on" ignoreCase="true" />
<action type="Rewrite" value="max-age=31536000; includeSubDomains; preload" />

Internet Information Services
{count} votes