Application Initialization module fails when web site requires SSL

Applies to: ASP.NET

Symptoms


Application Initialization module formerly known as “Application Warmup” is not working for web site configured to require SSL.

Cause


This behavior is by design.

The warm-up module sends the request using HTTP protocol and not with HTTPS. The workaround suggested will allow HTTP requests to localhost from warm up module but it redirects to the HTTPS for the rest of the requests so by design here means that the warm up module makes requests over HTTP.

Resolution


To workaround this limitation, you may consider enabling HTTP (uncheck the "Require SSL" setting in IIS Manager/SSL Settings) and use a URL Rewrite rule to redirect HTTP requests to HTTPS with the exception of the request coming from the warmup module : 

<rewrite> 
<rules>
<rule name="No redirect on warmup request (request from localhost with warmup user agent)" stopProcessing="true">>
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="localhost" />
<add input="{HTTP_USER_AGENT}" pattern="Initialization" />
</conditions>
<action type="Rewrite" url="{URL}" />
</rule>
<rule name="HTTP to HTTPS redirect for all requests" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" />
</rule>
</rules>
</rewrite>