2

I have created an Azure CDN, an endpoint and working fine.

Created a CNAME www.mydomain.com to myazurecdn.azureedge.net Created another CNAME mydomain.com to www.mydomain.com

In Azure Endpoint, Custom Domain, I updated www.mydomain.com and it got propagated.

Now, when I navigate to www.mydomain.com, everything works fine but when I navigate to mydomain.com i get below response.

Our services aren't available right now

We're working to restore all services as soon as possible. Please check back soon.

Note: As Azure endpoint accepts multiple custom domain, I could add both www.mydomain.com and mydomain.com but it is not correct way, as I have many <a> tags with www.mydomain.com/link.

What to be done now to instruct system to use same route for mydomain.com and www.mydomain.com?

Is domain redirect from domain.com to www.mydomain.com only option?

Ramesh
  • 1,041
  • 15
  • 39
  • Strictly speaking you shouldn't be allowed to set a CNAME on mydomain.com because it is an "apex domain". Only sub-domains like www.mydomain.com can be CNAMEd. – juunas Jun 05 '19 at 09:25

2 Answers2

1

Have a look at this,

A custom domain and its subdomain can be associated with only a single endpoint at a time. However, you can use different subdomains from the same custom domain for different Azure service endpoints by using multiple CNAME records. You can also map a custom domain with different subdomains to the same CDN endpoint.

You can use different subdomains in the same endpoint. Alternatively, I think you also could create two endpoints, one is for the root domain without www, the other is for a subdomain with www.

Nancy
  • 26,865
  • 3
  • 18
  • 34
  • 1
    Yes, in such case, some users may in domain.com and some may in www.domain.com, I would to like be all my users in one route i.e www.domain.com, what is the right way? – Ramesh Jun 05 '19 at 10:49
  • If you just want all users to access the websites with one custom domain, why don't you directly create one endpoint with one subdomain i.e www.domain.com? Or, if you want all traffic route to www subdomain, try to configure the Azure CDN’s Rules Engine, the Azure CDN Profile must be the Premium Verizon pricing tier. See this Rule 2: Redirect Root to www https://arlanblogs.alvarnet.com/add-url-rewrite-rules-to-an-azure-content-delivery-network/ – Nancy Jun 05 '19 at 15:14
-1

I would say, you can implement redirection in your server or CDN.

When someone tries to access example.com, you can do a 301 by sending http://www.example.com in the location header.

msrini-MSIT
  • 1,444
  • 1
  • 7
  • 11