Project

General

Profile

Mod deflate » History » Revision 26

Revision 25 (altblue, 2016-11-22 14:31) → Revision 26/43 (gstrauss, 2020-07-20 20:07)

h2. mod_deflate 

 


 mod_deflate (since lighttpd 1.4.42) enables output compression (Content-Encoding) of responses. 

 Output compression reduces the network load and can improve the overall throughput of the webserver. All major http-clients support compression by announcing it in the Accept-Encoding header. This is used to negotiate the most suitable compression method. We support deflate, gzip, bzip2, and brotli. (brotli support since 1.4.56) 

 deflate (RFC1950, RFC1951) and gzip (RFC1952) depend on zlib while bzip2 depends on libbzip2. bzip2 is only supported by lynx and some other console text-browsers.    brotli (RFC7932) is supported available in most popular browsers. 

 Since lighttpd 1.4.56, mod_deflate subsumes 1.4.42 and replaces mod_compress. later.    mod_deflate differs from mod_compress in that mod_deflate can compress any output from lighttpd static or dynamic.    mod_deflate does not support caching compressed output like mod_compress. 

 h3. Module options: 

 <pre> 
 deflate.mimetypes = ("text/html", "text/plain", "text/css", "text/javascript", "text/xml") 
 #deflate.mimetypes = ("text/")         # prefix matches all text/* Content-Type responses 
 deflate.mimetypes = ("text/html", "text/plain", "text/css", "text/javascript", "text/xml") 
 deflate.allowed-encodings = ( "brotli", "bzip2", "gzip", "deflate" ) # "bzip2" also supported 

 ## optional 

 deflate.cache-dir = "/path/to/compress/cache" 
 #deflate.max-compress-size deflate.max-compress-size = 131072     # measured in kilobytes, so 131072 indicates 128 MB 
 #deflate.min-compress-size deflate.min-compress-size = 256        # measured in bytes 
 #deflate.compression-level deflate.compression-level = 9 
 #deflate.output-buffer-size = 8192 
 #deflate.work-block-size deflate.work-block-size = 2048 
 #deflate.max-loadavg = "3.50" 
 </pre> 

 


 max-compress-size is the largest response size that will be compressed. 
 min-compress-size is the smallest response size that will be compressed. 

 output-buffer-size is a per connection buffer for compressed output, it can 
 help decrease the response size (fewer chunks to encode).    If it is set to 
 zero, a shared buffer will be used. 

 work-block-size is the number of kilobytes to compress at one time, it allows 
 the webserver to do other work (network I/O) in between compression. 

 max-loadavg is max system loadavg before bypassing compression (since 1.4.43) 

 h3. Known Limitation 

 mod_deflate currently does not stream compressed content in chunks.    This affects very large dynamic responses, or dynamic responses sent in chunks with large time lapses between chunks.    If the entire response is not ready when the response header is sent, 

 h3. (obsolete) patches to add mod_deflate does not process the response.    (e.g. dynamic response from backend and @server.stream-response-body@ is set) to versions prior to lighttpd 1.4.42 (YMMV)