0
votes

I have used cloud flare, the setup was very easy, just adding name servers helped out. But I am trying to do this in azure cdn.

I have created cdn profile and cdn end points for our web site http://example.com/ hosted in azure

Image in Origin Sever

http://example.com/Content/images/example-12169.jpg

Image in CDN

http://example.azureedge.net/Content/images/example-12169.jpg

And now I have to change my application code to fetch from azure cdn.

Example :

From

<img src="~/Content/images/example-12169.jpg" />

To

<img src="http://example.azureedge.net/Content/images/example-12169.jpg" />

Update:

I can see this doc , explaining C Name for sub domain , but how can i do it for root domain because it already has C Name named www for example.azurewebsites.net

Update 2:

For SEO purpose we need to set our domain with www.example.com , so the CNAME setup was

a   @   0.0.0.0 600 seconds

txt     @   example.azurewebsites.net   1 Hour

cname   www     example.azurewebsites.net   1 Hour

For using azure CDN with www subdomain I updated the CNAME value from example.azurewebsites.net to example.azureedge.net , so the CNAME setup is

cname   www     example.azureedge.net   1 Hour

Now when try to access www.example.com , I get Access denied.

I am using Akamai Standard CDN.

How can I Map azure cdn static content to existing domain name without changing the application code ?

1

1 Answers

0
votes

Is your html page which references the .jpg also on the CDN? If it is, you should not need to change the relative path. If not, you will need to rewrite to use the CDN explicitly.

Regarding your second question, since CNAME of an apex (or root) domain is not allowed, you can either do a http redirect from the apex domain to the www., or you can use a CDN provider that supports apex domains, such as DNSimple's ALIAS record and DNS Made Easy's ANAME record.