我认为这是一个简单的谷歌搜索,但显然我错了。
我看到你应该提供:
Accept-Encoding: gzip;q=0,deflate;q=0
在请求标头中。但是,建议它的文章还指出,代理通常会忽略该标头。另外,当我将它提供给 nginx 时,它仍然压缩了响应消息体。
http://forgetmenotes.blogspot.ca/2009/05/how-to-disable-gzip-compression-in.html
那么,如何告诉 Web 服务器禁用响应消息正文的压缩?
我认为这是一个简单的谷歌搜索,但显然我错了。
我看到你应该提供:
Accept-Encoding: gzip;q=0,deflate;q=0
在请求标头中。但是,建议它的文章还指出,代理通常会忽略该标头。另外,当我将它提供给 nginx 时,它仍然压缩了响应消息体。
http://forgetmenotes.blogspot.ca/2009/05/how-to-disable-gzip-compression-in.html
那么,如何告诉 Web 服务器禁用响应消息正文的压缩?
许多 Web 服务器会忽略 'q' 参数。静态资源的压缩版本通常会被缓存,并在请求接受时返回。为避免获得压缩资源,请使用
Accept-Encoding: identity
在这种情况下,服务器不应为您提供资源的压缩表示。也不应该有任何代理。如果没有给出,这是默认接受的编码,但您的客户端可能会添加一个接受 gzip 的默认值,因此明确提供“身份”应该可以解决问题。
您希望完全禁用编码吗?
然后在 http 请求标头中跳过 Accept-Encoding 标头本身。
您是否只希望在 http 响应中不存在 gzip 压缩?
然后从 http 请求标头中的值列表中跳过 gzip。
您是否希望优先考虑服务器支持的不同压缩技术?然后对 Accept-Encoding http 请求标头中的每个值使用 0 和 1 之间的不同值以及 q 参数。(目前您正在使用冲突值并通过 weight=0 表示您不知道如何管理,但您希望无论如何都要对响应进行编码)
我认为这个 mod 的 apache
http://httpd.apache.org/docs/2.2/mod/mod_deflate.html (2)
这对于 Nginx
http://wiki.nginx.org/HttpGzipModule (1)
听起来像是您需要的,具体取决于您计划使用的服务器。剩下的就看你了!
请注意nginx模块都允许关闭解压:
[edit] gzip
Syntax: gzip on | off
Default: off
Context: http
server
location
if in location
Reference: gzip
Enables or disables gzip compression.
并处理代理:
[edit] gzip_proxied
Syntax: gzip_proxied off | expired | no-cache | no-store | private | no_last_modified | no_etag | auth | any ...
Default: off
Context: http
server
location
Reference: gzip_proxied
It allows or disallows the compression of the response for the proxy request in the dependence on the request and the response. The fact that, request proxy, is determined on the basis of line "Via" in the headers of request. In the directive it is possible to indicate simultaneously several parameters:
off - disables compression for all proxied requests
expired - enables compression, if the "Expires" header prevents caching
no-cache - enables compression if "Cache-Control" header is set to "no-cache"
no-store - enables compression if "Cache-Control" header is set to "no-store"
private - enables compression if "Cache-Control" header is set to "private"
no_last_modified - enables compression if "Last-Modified" isn't set
no_etag - enables compression if there is no "ETag" header
auth - enables compression if there is an "Authorization" header
any - enables compression for all requests
[edit] gzip_types
最良好的祝愿!
资料来源:
1) http://forum.nginx.org/read.php?11,96472,214303
2)http://httpd.apache.org/docs/2.2/mod/mod_deflate.html#inflate(部分输出解压)