restricting IP security

2019-06-13 18:14发布

问题:

Having an issue with restricting IP security. I have made a web.config file and placed it in the folder I am trying to restrict see below:

<?xml version="1.0" encoding="UTF-8"?>
  <configuration>
   <system.webServer>
    <security>
      <ipSecurity allowUnlisted="false" enableProxyMode="true" denyAction="Forbidden">            
        <clear />           
        <add ipAddress="123.456.789" allowed="true" />
    </ipSecurity>
   </security>
 </system.webServer>
</configuration>

I have also adjusted the applicationHost.config to:

    <section name="ipSecurity" overrideModeDefault="Allow" />

However when browsing to a file in that folder I get a 403. I have restarted IIS and IP address is correct.

What am I missing?

回答1:

Check the client IP (c-ip) in IIS logs and add that to ip - restrictions rules.