IIS - URL Rewrite Using IP Restrictions

Phill Berry 1 Reputation point

Hi folks,

I have recently entered the world of IIS and one of the first things I picked up is the URL Rewrite module, I've used it for all sorts of rewrites and feel fairly comfortable until I picked up this query.

I am using Umbraco and wish to hide the umbraco login page based on IP addres so that a small set of IP addresses can still see it. I've scoured Google and various forums trying different methods, the simplest seems to be the following, bearing in mind I also have load balancing in the mixture hence the use of HTTP-X-FORWARDED-FOR.

Here is my example, if anyone could offer advice, I have also tried 'escaping' the IP addresses using . but this made no difference:

<rule name="Allowed IPs" enabled="true" patternSyntax="Wildcard" stopProcessing="true">   
<match url="*" />  
<add input="{URL}" pattern="/Umbraco/*" />  
<add input="{URL}" pattern="/Umbraco/surface/*" negate="true" />  
<add input="{URL}" pattern="/Umbraco/cms-api/*" negate="true" />  
<add input="{HTTP_X_FORWARDED_FOR}" pattern="" negate="true" />  
<add input="{HTTP_X_FORWARDED_FOR}" pattern="***.***.***.***" negate="true" />  
<action type="CustomResponse" statusCode="404" statusReason="Access Denied." statusDescription="Access Denied." />   
Internet Information Services
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Sam Wu-MSFT 7,036 Reputation points Microsoft Vendor

    @Phill Berry

    wish to hide the umbraco login page based on IP addres so that a small set of IP addresses can still see it

    IP Address and Domain Restrictions can fully meet your needs, more information about how to use Dynamic IP Address Restrictions you can refer to this link:

    Dynamic IP Address Restrictions.

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

  2. Wine History Tours 1 Reputation point

    Thank you for your help Sam, it turns out there was another web. config file nested in the umbraco build that what to expect at a tasting room conflicting with my changes.

    0 comments No comments