I have this web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<staticContent>
<remove fileExtension=".woff" />
<remove fileExtension=".woff2" />
<mimeMap fileExtension="woff" mimeType="application/font-woff" />
<mimeMap fileExtension="woff2" mimeType="application/font-woff2" />
</staticContent>
<webSocket enabled="false" />
<handlers>
<add name="iisnode" path="main.js" verb="*" modules="iisnode"/>
</handlers>
<rewrite>
<rules>
<rule name="Redirect to www">
<match url="(.*)" />
<conditions trackAllCaptures="false">
<add input="{HTTP_HOST}" pattern="^example.com$" />
</conditions>
<action type="Redirect" url="{MapProtocol:{HTTPS}}://www.example.com/{R:1}" />
</rule>
<rule name="301 Redirect 1" stopProcessing="true">
<match url="a-zero-sum-game-in-retail" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www.example.com$" />
</conditions>
<action type="Redirect" url="https://business.example.com/live-better/a-zero-sum-game-in-retail" redirectType="Permanent" />
</rule>
<rule name="301 Redirect 2" stopProcessing="true">
<match url="buying-online-doesnt-mean-shopping-online" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www.example.com$" />
</conditions>
<action type="Redirect" url="https://business.example.com/live-better/buying-online-doesnt-mean-shopping-online" redirectType="Permanent" />
</rule>
<rule name="301 Redirect 3" stopProcessing="true">
<match url="the-truth-about-experiential-retail" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www.example.com$" />
</conditions>
<action type="Redirect" url="https://business.example.com/live-better/the-truth-about-experiential-retail" redirectType="Permanent" />
</rule>
<rule name="301 Redirect 4" stopProcessing="true">
<match url="winning-the-battle-for-brand-engagement" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www.example.com$" />
</conditions>
<action type="Redirect" url="https://business.example.com/live-better/winning-the-battle-for-brand-engagement" redirectType="Permanent" />
</rule>
<rule name="301 Redirect 5" stopProcessing="true">
<match url="experiential-technology-in-retail" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www.example.com$" />
</conditions>
<action type="Redirect" url="https://business.example.com/live-better/experiential-technology-in-retail" redirectType="Permanent" />
</rule>
<rule name="301 Redirect 6" stopProcessing="true">
<match url="what-retailers-have-forgotten" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www.example.com$" />
</conditions>
<action type="Redirect" url="https://business.example.com/live-better/what-retailers-have-forgotten" redirectType="Permanent" />
</rule>
<rule name="301 Redirect 7" stopProcessing="true">
<match url="live-better" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www.example.com$" />
</conditions>
<action type="Redirect" url="https://business.example.com/live-better" redirectType="Permanent" />
</rule>
<rule name="301 Redirect 8" stopProcessing="true">
<match url="contact" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www.example.com$" />
</conditions>
<action type="Redirect" url="https://business.example.com/contact" redirectType="Permanent" />
</rule>
<rule name="301 Redirect 9" stopProcessing="true">
<match url="pricing" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www.example.com$" />
</conditions>
<action type="Redirect" url="https://business.example.com/pricing" redirectType="Permanent" />
</rule>
<rule name="301 Redirect 10" stopProcessing="true">
<match url="locations" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www.example.com$" />
</conditions>
<action type="Redirect" url="https://business.example.com/locations" redirectType="Permanent" />
</rule>
<rule name="301 Redirect 11" stopProcessing="true">
<match url="managed-service" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www.example.com$" />
</conditions>
<action type="Redirect" url="https://business.example.com/managed-service" redirectType="Permanent" />
</rule>
<rule name="301 Redirect 12" stopProcessing="true">
<match url="partnerships" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www.example.com$" />
</conditions>
<action type="Redirect" url="https://business.example.com/partnerships" redirectType="Permanent" />
</rule>
<rule name="301 Redirect 13" stopProcessing="true">
<match url="about" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www.example.com$" />
</conditions>
<action type="Redirect" url="https://www.example.com/" redirectType="Permanent" />
</rule>
<rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
<match url="^main.js/debug[/]?" />
</rule>
<rule name="StaticContent">
<action type="Rewrite" url="public{REQUEST_URI}"/>
</rule>
<rule name="DynamicContent">
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
</conditions>
<action type="Rewrite" url="main.js"/>
</rule>
<rule name="Angular Routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.html" />
</rule>
</rules>
<rewriteMaps>
<rewriteMap name="MapProtocol">
<add key="on" value="https" />
<add key="off" value="http" />
</rewriteMap>
</rewriteMaps>
</rewrite>
<security>
<requestFiltering>
<hiddenSegments>
<remove segment="bin"/>
</hiddenSegments>
</requestFiltering>
</security>
<httpErrors existingResponse="PassThrough" />
</system.webServer>
</configuration>
It used to be working, but I have found that it no longer does. I have been trying to rack my brains to figure out why it isn't working and the only thing I can think of is the stopProcessing flag.
In my mind, the redirect should try to do the following:
- Try to redirect to www.
- Check the Url is not one of the urls in the moved site and redirect
- Start my node server
- Match the angular routes
The issue I have is that I "think" they should all have stopProcessing off, but they all have it on. Can someone explain why it shouldn't be off?
Or better still, explain to me why my web.config is not performing the redirects.
question from:
https://stackoverflow.com/questions/65918733/web-config-redirects-not-working-suspect-stopprocessing 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…