Azure的CDN - 启用HTTP的COM pression - 托管Web角色 [英] Azure CDN - Enabling HTTP Compression - Hosted Web Role

查看:241
本文介绍了Azure的CDN - 启用HTTP的COM pression - 托管Web角色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人成功<一个href=\"http://blogs.msdn.com/b/avkashchauhan/archive/2012/03/05/enableing-gzip-com$p$pssion-with-windows-azure-cdn-through-web-role.aspx\">configured Azure的CDN的HTTP COM pression 使用其托管Web角色?我们有在Azure的边缘服务器的麻烦COM pressing HTTP内容。该CDN只缓存的内容uncom pressed版本。

Has anyone successfully configured Azure CDN for HTTP compression using their hosted web role? We are having trouble compressing HTTP content at the Azure edge servers. The CDN is only caching the uncompressed version of the content.

如果我们打我们的资源链接( WebResource.axd的的)从非Azure的方法吧COM presses通过的gzip(使用xxxx.cloudapp.net/cdn/webresource个.axd 的),符合市场预期。但是,只要我们指出我们的资源链接的Azure CDN( xxxx.vo.msecnd.net 的),内容是担任了uncom pressed,尽管浏览器告诉Azure的CDN它接受gzip的。

If we hit our resource link (webresource.axd) from a non-Azure approach it compresses via gzip (using the xxxx.cloudapp.net/cdn/webresource.axd) as expected. However, as soon as we point our resource link to Azure CDN (xxxx.vo.msecnd.net), the content is served up uncompressed, despite the browser telling the Azure CDN it accepts gzip.

<我一个href=\"http://social.msdn.microsoft.com/Forums/en-US/windowsazuredata/thread/a88c31ff-3890-4b25-a7eb-3ee59f2193d3\">posted同样的问题天青论坛,但没有人回应的呢。

I posted this same issue to Azure Forums, but nobody has responded as of yet.

在排查故障时,似乎在Azure CDN被剥离出的的Accept-Encoding HTTP标头。只是好奇,如果其他人有同样的问题。

While troubleshooting the problem, it appears that the Azure CDN is stripping out the Accept-Encoding HTTP header. Just curious if others have had this same issue.

<一个href=\"http://blogs.msdn.com/b/windowsazure/archive/2011/03/18/best-practices-for-the-windows-azure-content-delivery-network.aspx\">Azure CDN最佳实践规定...

如何与COM pressed内容在Windows Azure CDN的工作?

How does the Windows Azure CDN work with compressed content?

在Windows Azure CDN不会修改(或增加)的COM pression到你的对象。在Windows Azure CDN尊重任何COM pression由产地基于接受编码标头提供。从1.4版本开始,Azure存储不支持COM pression。如果您是使用托管服务对象传递,你可以配置IIS返回COM pressed对象。

我们所看到的是,CDN不尊重原产地接受-编码,它被剥夺。

What we are seeing is that the CDN is not respecting the origin Accept-Encoding, it's being stripped away.

推荐答案

后来发现直通试错了Azure的CDN具有电流限制,它无法通过接受-编码 HTTP头除非它找到包含COM pressable名类型(的的.js,的.cs 的),或者你正在请求其原始名称的文件(的jquery.js,一个的site.css查询参数等等。的)。

It was discovered thru trial and error that Azure CDN has a current limitation that it won't pass the Accept-Encoding HTTP header unless it finds a QueryString parameter containing a compressable filename type (.js, .cs) or you are requesting a file by its original name (jquery.js, site.css, etc.).

这意味着,如果您使用的是 AXD资源处理程序 WebResource.axd的等的),则HTTP玉米pression将不会执行。在Azure CDN将只通过的Accept-Encoding 如果您追加查询参数以的.cs 的.js 扩展。

What this means is that if you are using an AXD resource handler (WebResource.axd, etc.), the HTTP compression will not be performed. The Azure CDN will only pass the Accept-Encoding if you append a QueryString parameter with a .cs or .js extension.

我们使用的自定义AXD资源处理程序,所以这是我们容易实现。我们只是应用&安培;组= core.js &安培;组= core.css 为我们共同的精缩资源和在COM pression担任预期。这是不幸的,这并不在当前的Azure CDN文档存在。

We are using a custom AXD resource handler, so this was easy for us to implement. We just applied &group=core.js and &group=core.css for our combined minified resources and the compression worked as expected. It's unfortunate this doesn't exist in the current Azure CDN documentation.

总之,我们必须从这个改造我们的URI:

In short, we had to transform our URIs from this:

<一个href=\"https://xxxx.vo.msecnd.net/resourceManager.axd?token=HL80vX5hf3lIAAA\">https://xxxx.vo.msecnd.net/resourceManager.axd?token=HL80vX5hf3lIAAA

这样:

<一个href=\"https://xxxx.vo.msecnd.net/resourceManager.axd?token=HL80vX5hf3lIAAA&group=core.js\">https://xxxx.vo.msecnd.net/resourceManager.axd?token=HL80vX5hf3lIAAA&group=core.js

一旦Azure的CDN看到的.js 在查询字符串,它将返回pssed资源版本的COM $ P $。

Once the Azure CDN sees the .js in the querystring, it will return the compressed version of the resource.

希望这可以帮助其他人使用网络资源(AXDs)通过在Azure CDN担任了。

Hope this helps someone else using web resources (AXDs) served up via the Azure CDN.

这篇关于Azure的CDN - 启用HTTP的COM pression - 托管Web角色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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