Azure CDN无法正确提供我的.html [英] Azure CDN is not serving my .html properly

查看:82
本文介绍了Azure CDN无法正确提供我的.html的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在CDN中设置了一些静态内容,但是当访问.html文件时,该文件将被下载并且不会在浏览器中呈现.

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.

我正在使用Blob容器

I am using a blob container

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

我不知道我错过了什么?

I don't know what I missed ?

推荐答案

我通过Fiddler跟踪了请求/响应,并注意到blob(index.html)上的Content-Type属性设置为application/octet-stream(默认设置) Azure中Blob的内容类型).这是下载而不是在浏览器中显示的原因,因为浏览器不知道如何处理此类内容.

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.

请将Blob的内容类型属性更改为text/html,HTML页面应该可以正常加载.

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

作为旁注,请尝试在Internet Explorer中访问URL,它应该可以工作(以我的经验,我发现IE比其他浏览器要聪明一些:).虽然其他浏览器都依赖于内容类型属性,但IE似乎很聪明地推断出文件类型).

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).

这篇关于Azure CDN无法正确提供我的.html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆