Skip to content

Instantly share code, notes, and snippets.

@SpiritLing SpiritLing/web.config Secret
Last active Jan 20, 2020

Embed
What would you like to do?
iis URL rewrite web.config
<?xml version="1.0" encoding="UTF-8"?>
<!--- Origin Release:https://blog.spiritling.cn/posts/82f57ccc/ -->
<!--- Origin Develop:https://dev.blog.spiritling.pub/posts/82f57ccc/ -->
<configuration>
<system.webServer>
<rewrite>
<rules>
<clear />
<!-- htpt => https -->
<rule name="demo-https" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{HTTPS}" pattern="^OFF$" />
<add input="{HTTP_HOST}" pattern="^demo\.example\.com$" />
</conditions>
<action type="Redirect" url="https://demo.example.com/{R:1}" />
</rule>
<!-- https domain/4436 => https domain:4436 -->
<rule name="demo" enabled="true" stopProcessing="true">
<match url="^4436/(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{HTTPS}" pattern="^ON$" />
<add input="{HTTP_HOST}" pattern="^demo\.example\.com$" />
</conditions>
<action type="Rewrite" url="https://demo.example.com:4436/{R:1}" />
</rule>
<!-- domain => https://localhost -->
<rule name="index" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^test\.example\.com$" />
</conditions>
<action type="Rewrite" url="https://localhost" />
</rule>
</rules>
</rewrite>
<caching enabled="false" enableKernelCache="false" />
</system.webServer>
</configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.