Created
January 11, 2018 09:04
-
-
Save l0ll098/6c884b0cd2fa9564b8ad80e3f5c5793e to your computer and use it in GitHub Desktop.
Force HTTPS on Azure/IIS websites. This file will rewrite every HTTP request to HTTPS. Works on Azure & IIS
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
<?xml version="1.0" encoding="utf-8"?> | |
<configuration> | |
<system.webServer> | |
<rewrite> | |
<rules> | |
<rule name="Redirect to https" enabled="true" stopProcessing="true"> | |
<match url="(.*)" /> | |
<conditions logicalGrouping="MatchAll" trackAllCaptures="false"> | |
<add input="{HTTPS}" pattern="off" /> | |
<add input="{HTTP_HOST}" pattern="localhost" negate="true" /> | |
</conditions> | |
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" /> | |
</rule> | |
</rules> | |
</rewrite> | |
</system.webServer> | |
</configuration> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment