Skip to main content

Compression

Compress responses with zstd, Brotli or gzip, chosen per client. Text such as HTML, JSON, CSS and JavaScript shrinks to 10–30% of its size.

Typecompress
CategoryTraffic
RequiresGoma Gateway 1.2.0 or newer
Gateway version

A route using this middleware fails to load on a gateway older than 1.2.0. Miabi does not read the running gateway's version, so nothing stops you saving it — the route is what reports the problem.

Fields​

FieldTypeRequiredDefaultDescription
algorithmslist of textno—Codings offered, in order of preference: zstd, br, gzip. Empty offers all three. Example: zstd.
minSizetextno—Smaller bodies are sent uncompressed. Bytes (1024) or a size such as 1KiB. Example: 1KiB.
levelsgroupno—Levels.
excludedPathslist of textno—Never compressed. Exclude pages that show user input next to a secret such as a CSRF token (BREACH). Example: /account/*.
excludedContentTypeslist of textno—Excluded content types. Example: application/pdf.
includedContentTypeslist of textno—Replaces the built-in list of text types. Empty keeps the built-in list. Example: text/*.
upstreamone of passthrough, identitynopassthroughpassthrough keeps a body the app already compressed. identity asks the app for an uncompressed body, so the gateway does all the compressing.

levels​

FieldTypeRequiredDefaultDescription
gzipnumberno—1 (fastest) to 9 (smallest). Example: 5.
brnumberno—1 to 11. Above 4 costs a lot of gateway CPU for little gain. Example: 2.
zstdone of fastest, default, better, bestno—zstd.