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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With