Last active
April 11, 2018 19:43
-
-
Save Fogh/d264ac614253f4f86e9bd6fa36656c64 to your computer and use it in GitHub Desktop.
Redirect HTTP to HTTPS, but allow .well-known for refreshing Lets Encrypt certificate
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> | |
<clear /> | |
<rule name="Allow LetsEncrypt" patternSyntax="Wildcard" stopProcessing="true"> | |
<match url=".well-known/*" /> | |
<action type="None" /> | |
</rule> | |
<rule name="Redirect to https" 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> | |
</rewrite> | |
</system.webServer> | |
</configuration> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment