Does mod_deflate skip gzip compression for responses smaller than DeflateBufferSize?
0 reputation · 30 Aug 2026, 00:28 UTC
Apache HTTP Server's mod_deflate controls gzip output through directives such as DeflateCompressionLevel and DeflateBufferSize, with compression normally enabled per MIME type via AddOutputFilterByType. The configuration goal is to serve gzipped application/octet-stream downloads with a consistent Content-Encoding: gzip header, a type that standard examples tend to leave out of the filter list.
What is unclear is how the filter treats a response whose body is smaller than the DeflateBufferSize value, the directive that sets the fragment size handed to zlib. It is not obvious from the directive descriptions whether such small payloads are compressed at all, whether the Content-Encoding header can differ between small and large responses of the same type, or whether the behavior changed between the 2.4 series and later releases. That makes it hard to predict what a client receives for a small binary download.
- Does mod_deflate compress responses smaller than
DeflateBufferSize, or pass them through uncompressed? - Which configuration reliably produces
Content-Encoding: gzipfor smallapplication/octet-streamresponses on Apache 2.4? - Is the behavior version-dependent, and where is it documented?