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:

    1. # This filter is only enabled for requests.
    2. typed_config:
    3. "@type": type.googleapis.com/envoy.extensions.filters.http.decompressor.v3.Decompressor
    4. decompressor_library:
    5. name: small
    6. typed_config:
    7. "@type": "type.googleapis.com/envoy.extensions.compression.gzip.decompressor.v3.Gzip"
    8. window_bits: 9
    9. response_direction_config:
    10. common_config:
    11. enabled:
    12. default_value: false
    13. runtime_key: response_decompressor_enabled
    14. - name: envoy.filters.http.decompressor
    15. typed_config:
    16. "@type": type.googleapis.com/envoy.extensions.filters.http.decompressor.v3.Decompressor
    17. name: large
    18. typed_config:
    19. "@type": "type.googleapis.com/envoy.extensions.compression.gzip.decompressor.v3.Gzip"
    20. window_bits: 12
    21. chunk_size: 16384
    22. request_direction_config:
    23. common_config:
    24. enabled:
    25. 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.