Expand description
The gzip node — compresses the response body with gzip when the client
accepts it and the response matches the configured content types and
minimum size. Port of APISIX’s gzip plugin (response-phase: place after
upstream, before client).
In APISIX the plugin only flips nginx’s gzip switches and nginx does the
actual work — including checking the request’s Accept-Encoding header
below APISIX. featherbit has no nginx underneath, so this node performs
the Accept-Encoding check and the compression itself (via
content_codec).
Deviations from APISIX:
http_versionandbuffersare not supported (nginx tuning knobs with no featherbit equivalent — responses are fully buffered).min_lengthis compared against the actual buffered body length, not the upstreamContent-Lengthheader (which APISIX/nginx skip checking when absent).
Structs§
- Gzip
Plugin - Compresses
Context.response.bodywith gzip, setscontent-encoding: gzip, and drops the stalecontent-lengthso the server layer recomputes it. Skipped (pure passthrough) when the client does not accept gzip, the response is already content-encoded, the content type does not match, or the body is shorter thanmin_length. This plugin never fails at execution time — a codec error logs a warning and leaves the response untouched.
Enums§
- Content
Types 🔒 - The
typesconfig: either any content type ("*") or an allowlist compared against the responsecontent-typestripped of parameters.
Functions§
- accepts_
encoding 🔒 - Whether the request’s
Accept-Encodingallowstoken(e.g."gzip","br"): the token (or*) must be listed with a non-zeroqvalue. A missing header means the client did not opt in — no compression. - response_
already_ 🔒encoded - Whether the response already carries a
content-encodingother than identity. Compressing twice (or compressing opaque encoded bytes) is never wanted, whatever the encoding is — so an unknown value also counts as encoded.