Configuring custom domain on traffic manager and web app

狂风中的少年 提交于 2020-06-25 06:44:50

问题


I refferred this microsoft doc, but it's confusing as mad.

https://docs.microsoft.com/en-us/azure/app-service/web-sites-traffic-manager-custom-domain-name

First they explain www.contoso.com will be the CNAME for <myapp>.trafficmanager.net. Then when web apps comes to picture they say www.contoso.com will be the CNAME for web app. They don't explain how both will work. When I will add hostname www.contoso.com to web app it is going to override the CNAME record for traffic manager. So next time I will hit www.contoso.com, it will go to web apps. Traffic manager went out of picture. If I will add preemptive record for traffic manager for e.g awverify.www.contoso.com CNAME to <myapp>.trafficmanager.net, what URL should I hit in browser to reach traffic manager and then to web app?

Can someone help how this whole thing works?


回答1:


The article is a tutorial to configure a custom domain for a web app which is managed by Azure Traffic Manager. At first, you should have a web app which uses Azure Traffic Manager profile.

They don't explain how both will work.

If www.contoso.com is the CNAME for <myapp>.trafficmanager.net,when you hit www.contoso.com, it will route to <myapp>.trafficmanager.net firstly, but finally it will route to your web app like <yourwebapp>.azurewebsites.net. Because the web app is configured with a Traffic Manager profile, there will be one or more endpoints which could route to your web app. So it is obviously that www.contoso.com is the CNAME of your web app like <yourwebapp>.azurewebsites.net actually.

Just like:

www.contoso.com--><myapp>.trafficmanager.net--><yourwebapp>.azurewebsites.net

If your web app without a Traffic Manager, it will be

www.contoso.com--><yourwebapp>.azurewebsites.net

When I will add hostname www.contoso.com to web app it is going to override the CNAME record for traffic manager. So next time I will hit www.contoso.com, it will go to web apps. Traffic manager went out of picture.

In the article:

Enable Traffic Manager

After the records for your domain name have propagated

As it says, you should add a DNS record for your custom domain(www.contoso.com). So if you hit the domain, it will route to <myapp>.trafficmanager.net, then to <yourwebapp>.azurewebsites.net. Not www.contoso.com straight to <yourwebapp>.azurewebsites.net.

If I will add preemptive record for traffic manager for e.g awverify.www.contoso.com CNAME to <myapp>.trafficmanager.net, what URL should I hit in browser to reach traffic manager and then to web app?

After creating a CNAME record for your custom domain, I think you should hit the custom domain.




回答2:


apologies for the confusion in the article. We will update it to make the steps clearer, but in the meantime, hope the info below helps you.

When you create an Azure Web App, the app will have its own DNS name .azurewebsites.net. If you have multiple web apps, each will get their own DNS name. Let's call them the endpoint DNS names.

Azure Traffic Manager can be used to direct traffic between these endpoints (an example would be you have websites in different Azure regions and would like to send traffic to the lowest latency location for the user). In order to do that, you first create a Traffic Manager profile and add these endpoint DNS names as the endpoints. This Traffic Manager profile also comes with its own DNS name .trafficmanager.net. When you add websites endpoints to a Traffic Manager profile, that Traffic Manager DNS name is added to the list of custom hostnames supported by the web app. What this means is that if someone navigates to your website using the Traffic Manager DNS name (which they should use to get the traffic routing benefits), the web app will respond correctly.

If you want to add your own branding to the URL you hand out to end users, you can use a vanity domain name like www.contoso.com and host it in a DNS hosting service such as Azure DNS. What you need to do here is to add a CNAME record to your contoso.com zone to point that to the Traffic Manager DNS name. An example would be

www.contoso.com. 60 IN CNAME contosotm.trafficmanager.net.

When you do this, any requests to www.contoso.com will be redirected to the Traffic Manager DNS name which will then pick a web app DNS name and give it back to the caller to connect to. In order for this to work, you need to make sure that you have added www.contoso.com to the custom domain list of each of the web apps.



来源:https://stackoverflow.com/questions/50166495/configuring-custom-domain-on-traffic-manager-and-web-app

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