Internet Information Services
Microsoft web server software.
1,328 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
We are going to be doing some maintenance on one of our pages and need to redirect all traffic to the maintenance page except for a list of admin IP's so they can work on site. I'm a novice at this but have looked around and found some ideas particularly with rewritemaps. I have come up with the below but when I test the pattern matching in IIS the result is always a pass as per the picture. Any tips on what I am doing wrong?
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<clear />
<rule name="HTTP to HTTPS redirect" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Found" />
</rule>
<rule name="Online services maintenance" enabled="false" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{Authorised Admin IPs:{REQUEST_URI}}" pattern="1" negate="true" />
</conditions>
<action type="Redirect" url="https://maintenance.website" appendQueryString="false" redirectType="Temporary" />
</rule>
</rules>
<rewriteMaps>
<rewriteMap name="Authorised Admin IPs" defaultValue="0">
<add key="127.0.0.1" value="1" />
<add key="localhost" value="1" />
<add key="::1" value="1" />
</rewriteMap>
</rewriteMaps>
</rewrite>
</system.webServer>
</configuration>