5
votes

Is it possible to prevent access to my Azure website from the Azure provided domain and force the use of the custom domain via a setting/configuration within Azure?

Right now I have a custom domain associated with my Azure Web App.

So, under domain names, there are 2 listed, my custom domain and the azure provided domain.

Example: mywebapp.com mywebapp.azurewebsites.net

I want traffic to only be allowed in via the custom domain. So, mywebapp.azurewebsites.net should either not be allowed or should redirect to mywebapp.com.

1
Would someone like to elaborate on the down vote?ShellyFM

1 Answers

5
votes

The easiest way is to change your web.config and add a URL Rewrite rule that will do a permanent redirect from the *.azurewebsites.net domain to your domain.

You can find an example on how they do that for domain.com to www.domain.com and you can apply the same logic. This article explains how to do that.