Azure web app with custom domains redirect non www to www

Yannick Vachon 31 Reputation points
2020-12-12T20:49:30.11+00:00

While trying to finish the setup of our new website on an Azure web App (the app is an asp.net core 3.1 if that matter), I struggle to redirect the non-www url to our www url.

Right now, our www over https url works as expected. But using the non www url gives me the "Your connection is not private" page, which is kind of expected since the certificate is configured over the www address (I used an App Service Managed Certificate for that). At the same time, in the website in the Startup class, I have a custom rule made that should do the redirect. Yet, it seems from my understanding that the block I see is triggerred before the the code is executed on the website.

I tried all solutions defined on those forums for non www to www questions, for naked redirect as well. I will admit that before this project, I never had to configure dns record at all and I'm kind of lost as to what I could do to make it work there. I even tried to not enforce https on the web app as a way of not blocking the request.

As for url right now, I have the following (each with their status):

I wonder at this point what I am missing.

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

Accepted answer
  1. ajkuma 22,416 Reputation points Microsoft Employee
    2020-12-14T18:27:01.83+00:00

    @Yannick Vachon , Adding more info:

    From the DNS configuration UI for your custom domain and follow the instructions at https://aka.ms/appservicecustomdns to configure a CNAME record for the hostname "www" and point it your web app's default domain name.
    Kindly see the document 'configure-ssl-certificate' for more details.

    App Service Managed Certificate (Preview) - It's a private certificate just to secure your www custom domain or any non-naked domain in App Service.

    Kindly see the different between App Service Certificate and App Service Managed Certificate (here).

    47988-image.png

    Hope this helps with some pointers. If you have further questions, please do share more details we will be more than happy to assist you.

    3 people found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Yannick Vachon 31 Reputation points
    2020-12-15T13:16:02.523+00:00

    Following your advice there, I bought a certificate from GoDaddy (using Azure portal to buy it). Took me let's say 20 minutes to fill the form, buy it, install everything and test it worked where I spent 20 hours trying to make the free certificate works without any success.

    At some point, spending a small amount to not lose that much time is a correct answer :)

    1 person found this answer helpful.