Force use of Azure custom domain

主宰稳场 提交于 2019-12-23 09:54:16

问题


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:


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.



来源:https://stackoverflow.com/questions/29830353/force-use-of-azure-custom-domain

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!