Background
We are trying to make use of azure deployment slots when we deploy our Sitecore 9.1 PaaS solution to Azure. However, it seems that after a slot swap, the site is not warmed up, which affects the first user of the website (=slow startup time).
Our entire website, is behind login (requireLogin=true), but we have some endpoints that are publicly available.
What we tried
Following the suggestions from several blogs, we tried the following:
- configure IIS application initialization, e.g:
<applicationInitialization doAppInitAfterRestart="true" xdt:Transform="Insert"> <add initializationPage="/" hostName="[URL-here]"/> <add initializationPage="/api/content/getloginconfig" hostName="[URL-here]"/> <add initializationPage="/init/warmup" hostName="[URL-here]"/> <add initializationPage="/auth/errors/accessdenied" hostName="[URL-here]"/> <add initializationPage="/auth/forgotpassword" hostName="[URL-here]"/> </applicationInitialization>
verified that we do not have any deployment slot specific settings
added rewrite rules to handle https redirection:
<rule name="Root Hit Force HTTPS Redirection" enabled="true" stopProcessing="true" xdt:Transform="Replace" xdt:Locator="Match(name)"> <match url="^$" ignoreCase="false"/> <conditions> <add input="{WARMUP_REQUEST}" pattern="1" negate="true" /> <add input="{REMOTE_ADDR}" pattern="^100?\." negate="true" /> <add input="{HTTPS}" pattern="^OFF$"/> <add input="{HTTP_METHOD}" pattern="GET"/> </conditions> <action type="Redirect" url="https://{HTTP_HOST}/" redirectType="Permanent"/> </rule> <rule name="Sitecore Login or Admin Force HTTPS Redirection" enabled="true" stopProcessing="true" xdt:Transform="Replace" xdt:Locator="Match(name)"> <match url="^(sitecore/(login|admin))$"/> <conditions> <add input="{WARMUP_REQUEST}" pattern="1" negate="true" /> <add input="{REMOTE_ADDR}" pattern="^100?\." negate="true" /> <add input="{HTTPS}" pattern="^OFF$"/> <add input="{HTTP_METHOD}" pattern="GET"/> </conditions> <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent"/> </rule> <rule name="Forbidden" xdt:Transform="Remove" xdt:Locator="Match(name)" /> <rule name="Force HTTPS Redirection" enabled="true" stopProcessing="true" xdt:Transform="Insert"> <match url="(.*)" ignoreCase="false"/> <conditions> <add input="{WARMUP_REQUEST}" pattern="1" negate="true" /> <add input="{REMOTE_ADDR}" pattern="^100?\." negate="true" /> <add input="{HTTPS}" pattern="^OFF$"/> <add input="{HTTP_METHOD}" pattern="GET"/> </conditions> <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent" /> </rule>
What are the best practices when using deployment slots for a website entirely behind login (requireLogin=true)?