I created a ARM template that creates App Service (web application) and Application Insights resource that is similar to this template (https://github.com/tomasr/webapp-appinsights). The App insights is connected to web app and everything works fine, the only problem is that app insights automatically generates requests to root of my web app as part of availability test that always return error because I don't have anything in the root path (even if I had, it is calling http instead of https url). There is nothing in the template that sets up this request, and if I go to availability properties, nothing is there. Is there a way to turn this feature off or configure it to call a valid URL?
0
votes
1 Answers
0
votes
In case it's Always On, the feature of App Service that keeps your app from going idle by pinging it with an HTTP GET to the root every once in a while, there is a way with Rewrite.
You can make a rewrite rule that has a condition that detects it's an Always On request, and if it is, make it hit another URL you specify instead. Here is an example:
<?xml version="1.0" encoding="UTF-8" standalone="no">
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Rewrite AlwaysOn" stopProcessing="true">
<match url="^$" />
<conditions>
<add input="{HTTP_USER_AGENT}" pattern="^AlwaysOn$" />
</conditions>
<action type="Rewrite" url="/api/Online/Ping" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Original article I found this from: https://blogs.msdn.microsoft.com/benjaminperkins/2018/08/10/how-to-optimize-azure-app-service-alwayson-cold-start-warm-up-request/
If you have a rewrite rule that redirects HTTP to HTTPS, you should add this rule before that.