What is the canonical method for an HTTP client to instruct an HTTP server to disable gzip responses?

前端 未结 3 1436
一个人的身影
一个人的身影 2020-12-16 14:13

I thought this was a simple google search, but apparently I\'m wrong on that.

I\'ve seen that you should supply:

Accept-Encoding: gzip;q=0,deflate;q=         


        
3条回答
  •  生来不讨喜
    2020-12-16 14:35

    I think this mod for apache

    http://httpd.apache.org/docs/2.2/mod/mod_deflate.html (2)

    And this for Nginx

    http://wiki.nginx.org/HttpGzipModule (1)

    Sounds like what you need depending on which server you plan to use. The rest is up to you!

    Please note the nginx module both allows shutting down decompression:

    [edit] gzip 
    Syntax: gzip on | off  
    Default: off 
    Context: http
    server
    location
    if in location 
    Reference: gzip 
    
    
    
    Enables or disables gzip compression. 
    

    And dealing with proxies:

    [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 
    

    Best wishes!

    Sources:

    1) http://forum.nginx.org/read.php?11,96472,214303

    2) http://httpd.apache.org/docs/2.2/mod/mod_deflate.html#inflate (Section Output Decompression)

提交回复
热议问题