title: Azure App Service Always On with custom domain redirect not hitting default web page
body: <p>Azure App Service AlwaysOn works perfectly once there is no custom domain set for the web application. Once custom domain is added along with URL rewrite rule to redirect all incoming request to it, application starts to response slowly after some time of inactivity. Logs show that AlwaysOn still pings azure domain and gets HTTP 301 response ans is not trying to request new URL.</p>
  
  <p>Log without custom domain:</p>
  
  <pre><code>2017-06-20 17:17:02 ZZTESTSITE GET / X-ARR-LOG-ID=743965b6-d3e2-42b9-9353-7772f9fbc898 80 - ::1 AlwaysOn ARRAffinity=b5289afa9cd711b67c1fe9137a6e3ff232f80bd3fa1bd96e9fc89992472b4e57 - zztestsite.azurewebsites.net 200 0 0 11433 652 15
  </code></pre>
  
  <p>Log with custom domain</p>
  
  <pre><code>2017-06-21 13:28:52 ZZTESTSITE GET / X-ARR-LOG-ID=ffcd5992-5019-48ca-a386-76443a8c7226 80 - ::1 AlwaysOn ARRAffinity=b5289afa9cd711b67c1fe9137a6e3ff232f80bd3fa1bd96e9fc89992472b4e57 - zztestsite.azurewebsites.net 301 0 0 553 652 46
  </code></pre>
  
  <p>URL Rewrite rule:</p>
  
  <pre><code>&lt;rule name="Redirect requests from default azure websites domain to custom one" stopProcessing="true"&gt;
    &lt;match url="(.*)" /&gt;
    &lt;conditions logicalGrouping="MatchAny"&gt;
      &lt;add input="{HTTP_HOST}" pattern="^zztestsite\.azurewebsites\.net$" /&gt;
    &lt;/conditions&gt;
    &lt;action type="Redirect" url="http://mycustomdomain.com" redirectType="Permanent" appendQueryString="false"/&gt;
  &lt;/rule&gt;
  </code></pre>
  
  <p>Additionally once SSL in enabled and another rule is added to redirect all requests to HTTPS, same issue will arise.</p>
  
  <p>How can I tackle this problem? I found two possible directions:</p>
  
  <ol>
  <li>Push AlwaysOn to ping custom domain (possibly https as an option)</li>
  <li>Change URL Rewrite rule to one allowing AlwaysOn to ping azure domain, but all other shall be redirected</li>
  </ol>
  
  <p>Please advise.</p>