compression

Enables Pingora’s built-in response compression when present in a filter chain.
On this page

Enables Pingora’s built-in response compression when present in a filter chain.

Configuration

FieldTypeRequiredDescription
levelintegernoDefault compression level for all algorithms. Clamped to each algorithm’s maximum (gzip: 9, brotli: 11, zstd: 22).
gzipAlgorithmConfignoGzip algorithm settings.
gzip.enabledboolnoWhether this algorithm is enabled.
gzip.levelintegernoCompression level for this algorithm.
brotliAlgorithmConfignoBrotli algorithm settings.
brotli.enabledboolnoWhether this algorithm is enabled.
brotli.levelintegernoCompression level for this algorithm.
zstdAlgorithmConfignoZstd algorithm settings.
zstd.enabledboolnoWhether this algorithm is enabled.
zstd.levelintegernoCompression level for this algorithm.
min_size_bytesintegernoMinimum body size in bytes; smaller responses skip compression.
content_typesstring[]noMIME type prefixes that qualify for compression.

Example

filter: compression
level: 6                        # default level for all algorithms
min_size_bytes: 256             # skip responses smaller than this
gzip:
  enabled: true
  level: 6
brotli:
  enabled: true
  level: 4
zstd:
  enabled: true
  level: 3
content_types:
  - "text/"
  - "application/json"
  - "application/javascript"
  - "application/xml"
  - "application/wasm"