Gzip Compression Configuration
The gzip plugin compresses eligible HTTP responses for clients that advertise gzip support, reducing response size on selected routes and services. Configuration covers plugin parameters.
Parameters
See plugin common configurations for configuration options available to all plugins.
types
valid value:
one or more nonempty MIME types, or*Response MIME types eligible for compression. Set to
*to allow any MIME type.The response must include
Content-Type. Parameters such ascharsetare ignored when matching a configured type.min_length
valid value:
greater than or equal to 1Minimum response
Content-Length, in bytes, eligible for compression. The plugin skips this check when the response does not include a numericContent-Length.comp_level
valid value:
between 1 and 9 inclusiveGzip compression level. Higher values can reduce response size further but require more CPU.
http_version
valid value:
1.0or1.1Minimum client HTTP version eligible for compression.
buffers
Memory buffers used while compressing a response.
number
valid value:
greater than or equal to 1Number of compression buffers.
size
valid value:
greater than or equal to 1Size of each compression buffer in bytes.
In API7 Gateway 3.9.23 and APISIX 3.19.0, keep the default size. Support for smaller custom buffers was corrected in API7 Gateway 3.10.10 and APISIX 3.20.0.
vary
If true, append
Accept-Encodingto theVaryresponse header after the configured type, length, and HTTP-version checks pass, including when NGINX does not compress the response for the current client.