Is it possible to use slots with a custom domain, in this case Cloudflare as the DNS provider and how?

Cliff Cawley 96 Reputation points

I've recently upgraded my Web App so that I can make use of slots.

I use Azure dev ops to just deploy to the main web app but have now changed it to deploy to a staging slot first and then after approval I call Swap slots.

Both production and staging work fine by themselves ( works and works), but as soon as I swap staging to production and visit my web browser reports Too many redirects.
(It's difficult to debug this because it's a live production site and downtime means upset users, so I just quickly swap slots back again to 'fix').

I use Cloudflare to host my dns with an A record and TXT record and I've setup a custom domain for to point to

I noticed the staging slot custom domain page doesn't have the domain setup but I'm not sure if it's needed.

The TXT record still points to so I'm wondering if this is part of the problem?

I've been unable to find any documentation on how this should be setup.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,223 questions
{count} votes

Accepted answer
  1. Cliff Cawley 96 Reputation points

    Okay, I've figured it out. It had nothing to do with swapping slots and was simply reproduced by accessing through a custom domain name (direct access worked fine)

    I had:


    But because I'm using Cloudflare's HTTPS certificates which only does from browser to cloudflare, Azure was receiving an incoming HTTP connection and attempting to redirect to HTTPS, when it was already HTTPS.

    Not sure why this behaviour didn't happen in .Net Core 2.2, but in .Net Core 3.1 it definitely does!

    I've removed this for now till I upgrade and use my own certificate and this has resolved the endless redirect loop

1 additional answer

Sort by: Most helpful
  1. Kamal Kumar Khandelwal 1 Reputation point

    Dear Sir,
    It's possible that custom domain is used to map with Azure storeage static web site or not.. ?

    0 comments No comments