1

I have setup some static content in a CDN but when accessing the .html file, the file gets downloaded and not rendered in the browser.

I am using a blob container

http://cdn-dezelo-consulting01.azureedge.net/index.html

I don't know what I missed ?

fran6
  • 341
  • 1
  • 4
  • 14

1 Answers1

6

I traced the request/response through Fiddler and noticed the Content-Type property on your blob (index.html) is set as application/octet-stream (which is default content type for a blob in Azure). This is the reason it is being downloaded instead of displayed in the browser because the browser doesn't know how to deal with this type of content.

enter image description here

Please change the content type property of the blob to text/html and the HTML page should load just fine.

As a side note, try accessing the URL in Internet Explorer and it should work (In my experience I have found IE to be a bit smarter than other browsers :). While other browsers rely on content type property, IE seems to infer the file type rather smartly).

Gaurav Mantri
  • 128,066
  • 12
  • 206
  • 241
  • Thank you Gaurav ! I am battling to find how to achieve that with nodejs scripting. So far, I am able to list the content of the blob, now I need to find the command to change the content-type for .html files using nodejs. Can you possibly point me to the right direction ? – fran6 Dec 22 '15 at 08:25
  • I haven't used node SDK in a while so unfortunately I won't be able to post the code. But what you have to do is list the blobs and update the content-type property to an appropriate value for each blob and then save the properties back again. If the number of files are small, you may be better off using any storage explorer and just change the properties manually. HTH. – Gaurav Mantri Dec 22 '15 at 08:29
  • I got it finally ! Excellent resource here: http://willi.am/blog/2014/07/08/azure-blob-storage-and-node-blob-metadata/ – fran6 Dec 22 '15 at 08:34