[SOLVED] Azure web.config restricting IP Addresses page refresh exception

Issue

I’m trying to restrict access to an Azure website to certain IP addresses.
It’s mainly a PHP 5.4 site but I’ve used web.config to allow/restrict access.
Currently it denies everybody except the listed IPs, however, when the page first loads from an allowed IP address it always displays the exception first:

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

if the page is then refreshed it delivers the page to the user as normal/expected. The exception seems to happen whenever the browser (Chrome or Firefox) is first opened or when the web page is closed and then visited again after a long gap.

The web.config is in the root directory and there is no other authentication as yet.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
 <system.webServer>
  <security>
   <ipSecurity allowUnlisted="false" denyAction="NotFound">
     <clear/>
     <add allowed="true" ipAddress="XX.XX.XXX.XXX" />
    </ipSecurity>
   </security>
  </system.webServer>
</configuration>

Solution

Azure support got back to me and said it was a bug that would be fixed in a future update.

However, there is also a fix -> switching the site to be in ‘Always On’ mode

This requires that the site is up using the basic / standard tiers i.e. you can’t use ‘always on’ in the free tier.

Well, hopefully you can still get it to work using the free tier… once they fix the bug 🙂

Answered By – user634319

Answer Checked By – Timothy Miller (BugsFixing Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *