Skip to content

Commit

Permalink
Add Strict-Transport-Security header
Browse files Browse the repository at this point in the history
Signed-off-by: Laurie0131 <[email protected]>
  • Loading branch information
Laurie0131 committed Sep 7, 2021
1 parent 71fd572 commit 11aa254
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions _includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,38 @@
-->

<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Strict-Transport-Security" value="max-age=31536000"/>
</customHeaders>
</httpProtocol>
</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>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />

Expand Down

0 comments on commit 11aa254

Please sign in to comment.