Decompressor
When the decompressor filter is enabled, headers are inspected to determine whether or not the content should be decompressed. The content is decompressed and passed on to the rest of the filter chain. Note that decompression happens independently for request and responses based on the rules described below.
Currently the filter supports and brotli compression only. Other compression libraries can be supported as extensions.
An example configuration of the filter may look like the following:
By default decompression will be skipped when:
A request/response does NOT contain content-encoding header.
A request/response includes content-encoding header, but it does not contain the configured decompressor’s content-encoding.
A request/response contains a cache-control header whose value includes “no-transform”.
When decompression is applied:
The content-length is removed from headers.
If an updated content-length header is desired, the buffer filter can be installed as part of the filter chain to buffer decompressed frames, and ultimately update the header. Due to a buffer filter needs to be installed after the decompressor for requests and prior to the decompressor for responses.
The content-encoding header is modified to remove the decompression that was applied.
x-envoy-decompressor-<decompressor_name>-<compressed/uncompressed>-bytes trailers are added to the request/response to relay information about decompression.
If different compression libraries are desired for requests and responses, it is possible to install multiple decompressor filters enabled only for requests or responses. For instance:
# This filter is only enabled for requests.
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.decompressor.v3.Decompressor
decompressor_library:
name: small
typed_config:
"@type": "type.googleapis.com/envoy.extensions.compression.gzip.decompressor.v3.Gzip"
window_bits: 9
response_direction_config:
common_config:
enabled:
default_value: false
runtime_key: response_decompressor_enabled
- name: envoy.filters.http.decompressor
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.decompressor.v3.Decompressor
name: large
typed_config:
"@type": "type.googleapis.com/envoy.extensions.compression.gzip.decompressor.v3.Gzip"
window_bits: 12
chunk_size: 16384
request_direction_config:
common_config:
enabled:
default_value: false
Every configured Deompressor filter has statistics rooted at <stat_prefix>.decompressor.<decompressor_library.name>.<decompressor_library_stat_prefix>.<request/response>* with the following:
Additional stats for the decompressor library are rooted at <stat_prefix>.decompressor.<decompressor_library.name>.<decompressor_library_stat_prefix>.decompressor_library.