0

I have a ASP.Net Core 2.2 site running as an Azure AppService. As part of the configuration, I have a custom domain with the HTTPS only setting turned on.

I also have the Always on setting turned on on my Appservice.

According to this article https://ruslany.net/2017/11/most-common-deployment-slot-swap-failures-and-how-to-fix-them/ the Always on setting will be ignored when HTTPS only is on and as a result, my site is always doing a cold start with the first call.

According to the same article, a rule condition can be set in the web.config to not process the Redirect to HTTPS rule if a {warmup_request} is processed.

However, my HTTPS only is set on the custom domain in Azure and not as a rule in the web.config.

I am setting RouteOptions in startup.cs with the following code:

services.Configure<RouteOptions>(options =>
{
    options.LowercaseUrls = true;
});

and believe that the rule condition can be done here as well using options.ConstraintMap() but I am unsure as to the syntax or method required to represent the following:

  <match url="(.*)" />
  <conditions>
    <add input="{WARMUP_REQUEST}" pattern="1" negate="true" />
    <add input="{REMOTE_ADDR}" pattern="^100?\." negate="true" />
    <add input="{HTTPS}" pattern="^OFF$" />
  </conditions>
  <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
</rule>

Any help on how to do this will be appreciated

Thanks

Ferdi
  • 31
  • 1
  • 7

1 Answers1

1

From the time this article was written the "https only" has been added as a built-in feature of app services so there is no need to use this rewrite rule anymore.

As to how to minimize the cold start for your application - you may want to consider adding appinit configuration to the web.config as described in App Service Warm-Up Demystified

RuslanY
  • 784
  • 6
  • 7
  • Thanks for the answer @ruslany Is there an Azure appsetting that I can use rather than the web.config? – Ferdi Oct 04 '20 at 23:24