Using Windows Azure CDN to store static files for a website
I worked all night yesterday to get this working for my site. Turns out there are multiple issues you have to remember and work out for all of it to work properly.
1. Write a program which will upload your folder structure to BLOB storage.
2. This program should also set the proper content types for different types of files. For ex; if you do not set proper content type to a CSS file your sites CSS file will not load on any modern browser.
This is why you will search high and low for cross domain CSS file in Azure CDN not rendering on browser.
3. There is some security setting which prevents cross domain CSS files from loading on a web site. This means you have to be able to go to the correct target page on the Azure CDN from a subdomain of your domain name.
Ex: if you host the site on xyz.com, your CSS cannot come from abc.com, but it can come from abx.xyz.com
4. To do this you have to enable custom domain on the azure storage.
http://www.windowsazure.com/en-us/develop/net/common-tasks/custom-dns/
5. Once you follow those steps to configure it and set it up, it should work.
Note: Right now, for some reason the Azure CDN is throwing errors left and right and is not working due to some certificate expiration issue.
6. So, what you can do at present is to just create a CNAME record pointing from abc.xyz.com to bloburl.com. And it works fine.
Remember, even with all this if you do not set the content type for each file properly, the browser may not work with that content.
1. Write a program which will upload your folder structure to BLOB storage.
2. This program should also set the proper content types for different types of files. For ex; if you do not set proper content type to a CSS file your sites CSS file will not load on any modern browser.
This is why you will search high and low for cross domain CSS file in Azure CDN not rendering on browser.
3. There is some security setting which prevents cross domain CSS files from loading on a web site. This means you have to be able to go to the correct target page on the Azure CDN from a subdomain of your domain name.
Ex: if you host the site on xyz.com, your CSS cannot come from abc.com, but it can come from abx.xyz.com
4. To do this you have to enable custom domain on the azure storage.
http://www.windowsazure.com/en-us/develop/net/common-tasks/custom-dns/
5. Once you follow those steps to configure it and set it up, it should work.
Note: Right now, for some reason the Azure CDN is throwing errors left and right and is not working due to some certificate expiration issue.
6. So, what you can do at present is to just create a CNAME record pointing from abc.xyz.com to bloburl.com. And it works fine.
Remember, even with all this if you do not set the content type for each file properly, the browser may not work with that content.
Comments
Post a Comment