Skip to main content

Module compression

Module compression 

Source

Constants§

MIN_COMPRESS_SIZE
Bodies smaller than this are sent uncompressed: gzip’s framing overhead and the CPU time outweigh what it saves (Caddy’s encode uses the same minimum).

Functions§

apply_gzip
If the client accepts gzip and the response body is compressible text of at least MIN_COMPRESS_SIZE bytes, compress every content range in-place and add Content-Encoding: gzip; also appends Accept-Encoding to the Vary header. A body that gzip doesn’t make smaller (already compressed or random data) is left as it was, and so is a response that already has a Content-Encoding (e.g. a backend that compressed it).