Closed blairlearn closed 2 years ago
Somewhere in the system.webServer
section, the rule should look something like this.
<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>
<rule name="Redirect root" stopProcessing="true">
<match url="^$" />
<action type="Redirect" url="https://www.cancer.gov" />
</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>
IMPORTANT: Verify the Redirect root
rule only fires when the connection is already HTTPS.
Set up a redirect of the root document
The redirect currently in place on the ALB for the
/
route is unable to implement HSTS. We'll need to set this up in the application's config.Rules need to be applied in this order:
strict-transport-security
header with a value ofmax-age=31536000; includeSubDomains; preload
/
, then redirect to https://www.cancer.gov.As part of deploying this change, it will be necessary to remove the current ALB rule which handles the
/
path.Resources:
Prerequisites
Sub-Tasks
Notes
Some complementary notes if necessary: