IIS6在请求中包含Via头时不执行gzip压缩 [英] IIS6 not doing gzip compression when including Via header in request

查看:195
本文介绍了IIS6在请求中包含Via头时不执行gzip压缩的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些静态内容通过CDN。我正在使用IIS6的内置压缩(gzip和amp; deflate)来获取静态内容,这在我请求它时工作正常。但是,当CDN对内容进行初始请求时,它不会被返回压缩。因此,他们没有压缩内容转发给请求它的人。 (是的,这引发了人们通过无法处理压缩的浏览器从CDN请求[压缩]内容的问题。 - 我们现在暂时将其放在一边)

I have some static content going through a CDN. I am using IIS6's built in compression (gzip & deflate) for static content and this is working fine when I request it. However, when the CDN makes the initial request for the content, it is not being returned compressed. They therefore don't have compressed content to forward to people requesting it. (Yes this raises the issue of people requesting [the zipped] content from the CDN with a browser that can't handle the compression. - We'll put that to one side for now though)

以下是没有'Via'标题的请求示例:

Here's an example of requesting without the 'Via' header:


    HEAD /flash/swfobject.js HTTP/1.1  
    User-Agent: curl/7.19.7 (i386-pc-win32)  
    Host: localhost:9120  
    Accept: */*  
    Connection: Keep-Alive  
    accept-encoding: gzip  

它返回一个压缩响应:


    HTTP/1.1 200 OK
    Content-Length: 4357
    Content-Type: application/x-javascript
    Content-Encoding: gzip
    Expires: Wed, 01 Jan 2020 00:00:00 GMT
    Last-Modified: Wed, 18 Nov 2009 15:36:52 GMT
    Accept-Ranges: bytes
    Vary: Accept-Encoding
    Server: Microsoft-IIS/6.0
    Date: Thu, 19 Nov 2009 10:27:50 GMT

如何永远,如果我在请求中包含一个'Via'标题(如CDN那样),那么结果将返回未压缩状态:

However, if I include a 'Via' header in the request (as the CDN does) then the result comes back uncompressed:

请求:


    HEAD /flash/swfobject.js HTTP/1.1
    User-Agent: curl/7.19.7 (i386-pc-win32)
    Host: localhost:9120
    Accept: */*
    Connection: Keep-Alive
    Via: 1.1 204.160.105.17:80 (Footprint 4.5/FPMCP)
    accept-encoding: gzip

回复:

 
    HTTP/1.1 200 OK
    Content-Length: 14602
    Content-Type: application/x-javascript
    Expires: Wed, 01 Jan 2020 00:00:00 GMT
    Last-Modified: Wed, 18 Nov 2009 15:36:54 GMT
    Accept-Ranges: bytes
    Server: Microsoft-IIS/6.0
    Date: Thu, 19 Nov 2009 10:29:52 GMT

是的,这些演示在请求中使用localhost。我使用来自不同网络上的各种机器的实际域名获得了相同的结果。

然后有两个问题:


  1. 由于额外的标头,这可能是IIS没有应用压缩吗?如果是这样我该怎么办呢?

  1. Could this be IIS not applying the compression due to the extra header? and if so what can I do about it?

如何在返回内容之前判断代理是否正在解压缩内容?

How can I tell if the proxy is decompressing the content before returning it?

奖金问题3 - 如何进一步调查此问题?

Bonus question 3 - What can I do to investigate this problem further?

I我知道问题332049,但是在回复中有标题,而不是请求。

I am aware of question 332049, but that has the header in the response, not the request.

推荐答案

我偶然发现了你的问题我自己研究这个。我发现了一个关于MSDN 的文章,简短的回答是Via头用于代理,代理通常会压缩压缩。您可以选择删除标头,也可以更改IIS元数据库中的设置(HcNoCompressionForProxies =FALSE)。我在这两个方面都取得了成功。

I stumbled across your question while researching this myself. I uncovered an article on MSDN and the short answer is that the Via header is used for proxies and proxies typically mess up compression. You either have the option of removing the header or you can change the setting in the IIS metabase (HcNoCompressionForProxies="FALSE"). I had success with both options.

这篇关于IIS6在请求中包含Via头时不执行gzip压缩的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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