Jeff Sanders Technical Blog

I am a Microsoft employee that has worked on all aspects of the Web Stack for a long time. I hope these blogs are useful to you! Use this information at your own risk.


<< Go Back

Iis Azure Web App Force Https Alwayson Ping Should Return 200 For Fastcgi Sites

- 28 Apr 2017

PHP, Java and other FastCGI hosted environments should respond to an Always On ping to keep the child process warmed up.  Specifically in Azure App Services we send a request to the Root of the site with the header User-Agent: AlwaysOn.  If you are forcing HTTPS using a Url Rewrite rule, the Always On ping will get a redirect but will not follow that redirect and therefore the FastCGI module will not be hit and kept warm.

Solution

You can simply add a rule that will look for the ping to the root of your site and the User-Agent: AlwaysOn header and not force HTTPS.  The easiest way to do this is to add this Url Rewrite rule before the Force HTTPS rule as follows:

                         <rule name=”No HTTPS for user agent AlwaysOn and Root of site” stopProcessing=”true”>                <match url=”^$”/>                                 <add input=”{HTTP\_USER\_AGENT}” pattern=”^AlwaysOn$” />                               <action type=”None” />             </rule> The above rule will look for a match for a request to the root and with a User-Agent header of “AlwaysOn”.  If that condition is met, no other rules are processed. ## Conclusion If you find this blog is useful please drop me a note!  Ref:  [http://microsoftazurewebsitescheatsheet.info/](http://microsoftazurewebsitescheatsheet.info/ "http://microsoftazurewebsitescheatsheet.info/")  Force HTTPS << Go Back