Created
October 15, 2017 01:12
-
-
Save xt0rted/33b554069e94e00cb76f1dc327fd7e0f to your computer and use it in GitHub Desktop.
applicationHost.xdt for Kudu to force HTTPS & remove custom/server headers
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"?> | |
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> | |
<location path="%XDT_SITENAME%" xdt:Transform="InsertIfMissing" xdt:Locator="Match(path)"> | |
<system.webServer xdt:Transform="InsertIfMissing"> | |
<applicationInitialization xdt:Transform="InsertIfMissing"> | |
<add initializationPage="/" xdt:Transform="InsertIfMissing" /> | |
</applicationInitialization> | |
<httpProtocol xdt:Transform="InsertIfMissing"> | |
<customHeaders xdt:Transform="InsertIfMissing"> | |
<add xdt:Transform="Remove" /> | |
</customHeaders> | |
</httpProtocol> | |
<security xdt:Transform="InsertIfMissing"> | |
<requestFiltering removeServerHeader="true" xdt:Transform="SetAttributes(removeServerHeader)" /> | |
</security> | |
<rewrite xdt:Transform="InsertIfMissing"> | |
<rules xdt:Transform="InsertIfMissing"> | |
<rule name="Force HTTPS" enabled="true" stopProcessing="true"> | |
<match url="(.*)" ignoreCase="false" /> | |
<conditions> | |
<add input="{HTTPS}" pattern="off" /> | |
<add input="{WARMUP_REQUEST}" pattern="1" negate="true" /> | |
</conditions> | |
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent" /> | |
</rule> | |
</rules> | |
</rewrite> | |
</system.webServer> | |
</location> | |
</configuration> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment