Created
August 9, 2023 20:00
-
-
Save cemerson/c4d8d92d54e723c5600da6a6cfb4fb39 to your computer and use it in GitHub Desktop.
HTTP to HTTPS redirect for web.config (ASP.NET)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<system.webServer> | |
<rewrite> | |
<rules> | |
<rule name="HTTP to HTTPS" stopProcessing="true"> | |
<match url="^(.*)$" ignoreCase="false" /> | |
<conditions> | |
<add input="{HTTP_X_FORWARDED_PROTO}" pattern="^http$" ignoreCase="false" /> | |
</conditions> | |
<action type="Redirect" url="https://{SERVER_NAME}{URL}" redirectType="Found" /> | |
</rule> | |
</rules> | |
</rewrite> | |
<httpProtocol> | |
<customHeaders> | |
<add name="Strict-Transport-Security" value="max-age=31536000; includeSubDomains; preload" /> | |
</customHeaders> | |
</httpProtocol> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment