Why is the gzip minimum length directive not being respected? Why is the gzip minimum length directive not being respected? nginx nginx

Why is the gzip minimum length directive not being respected?


Confirming my note above, this does seem to correspond to the note in the NGINX gzip module documentation stating "The length is determined only from the “Content-Length” response header field."

With gzip_min_length 1000;, my JSON responses were being gzip'ed, even if they were only 100 bytes.

I changed my application to add the Content-Length: 100 header and NGINX sends the JSON response without using the gzip encoding.

If I change the configuration to gzip_min_length 80; with the same 100-byte Content-Length, then NGINX applies the gzip encoding as expected.

Short story: you need to apply the Content-Length header for NGINX to properly handle the gzip_min_length check.