Expand description
The brotli node — compresses the response body with brotli when the
client accepts it and the response matches the configured content types
and minimum size. Port of APISIX’s brotli plugin (response-phase: place
after upstream, before client).
Shares its gating helpers (Accept-Encoding parsing, content-type
matching, already-encoded detection) with the gzip node;
featherbit performs the Accept-Encoding check explicitly since there is
no nginx below the gateway to do it.
Deviations from APISIX:
mode,lgwin,lgblock, andhttp_versionare not supported —content_codecuses generic mode with its own window size, and responses are fully buffered.min_lengthis compared against the actual buffered body length, not the upstreamContent-Lengthheader.
Structs§
- Brotli
Plugin - Compresses
Context.response.bodywith brotli, setscontent-encoding: br, drops the stalecontent-length, and downgrades a strongETagto a weak one (as APISIX does — the compressed bytes are not byte-identical to the original representation). Skipped (pure passthrough) when the client does not acceptbr, 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.
Functions§
- weaken_
etag 🔒 - Mirrors APISIX’s
weak_etag_header: a strong quoted etag ("abc") becomes weak (W/"abc"), a weak etag is kept, and a non-standard (unquoted) etag is dropped since it cannot be weakened.