问题描述
我的Azure Web应用程序(myapp.azurewebsites.net)被映射到自定义域(client1.mycompany.com).
My azure web application (myapp.azurewebsites.net) is mapped to a custom domain (client1.mycompany.com).
我将其映射到更多的自定义域(client2.mycompany.com,client3.mycompany.com等),每个客户端一个.
I will be mapping it to some more custom domains (client2.mycompany.com, client3.mycompany.com etc.) one per each client.
在Web应用程序中,我正在使用
In web application I am using
HttpContext.Current.Request.Url.Host
获取正在访问应用程序的自定义域地址.但这有时会返回myapp.azurewebsites.net而不是自定义域.
to get custom domain address which is accessing the application. But it is sometimes returning myapp.azurewebsites.net instead of custom domain.
有什么主意如何以可靠的方式在Azure中自定义域URL?
Any idea how I can custom domain url in Azure in reliable way?
推荐答案
正如Admir在他的回答中所说,默认* .azurewebsites.net绑定无法删除,但是很容易阻止用户使用此域名作为您的域名地点.
As Admir said in his answer the default *.azurewebsites.net binding cannot be removed, but it is very easy to prevent users from using this domain name for your site.
<rewrite>
<rules>
<rule name="Canonical Host Name" patternSyntax="Wildcard" stopProcessing="true">
<match url="*" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="client1.mycompany.com" negate="true" />
</conditions>
<action type="Redirect" url="http://client1.mycompany.com/{R:1}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
这篇关于在Azure中获取映射的自定义域URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!