Compressor (proto)
This extension has the qualified name envoy.filters.http.compressor
Note
This extension is intended to be robust against untrusted downstream traffic. It assumes that the upstream is trusted.
Tip
This extension extends and can be used with the following extension category:
This extension must be configured with one of the following type URLs:
Compressor configuration overview.
extensions.filters.http.compressor.v3.Compressor
[extensions.filters.http.compressor.v3.Compressor proto]
{
"content_length": {...},
"content_type": [],
"disable_on_etag_header": ...,
"remove_accept_encoding_header": ...,
"runtime_enabled": {...},
"compressor_library": {...},
"request_direction_config": {...},
"response_direction_config": {...},
"choose_first": ...
}
- content_length
(UInt32Value) Minimum response length, in bytes, which will trigger compression. The default value is 30.
- content_type
(repeated string) Set of strings that allows specifying which mime-types yield compression; e.g.,
application/json,text/html, etc.When this field is not specified, compression will be applied to these following mime-types and their synonyms:
application/javascriptapplication/jsonapplication/xhtml+xmlimage/svg+xmltext/csstext/htmltext/plaintext/xml
- disable_on_etag_header
(bool) When this field is
true, disables compression when the response contains anETagheader. When this field isfalse, the filter will preserve weakETagvalues and remove those that require strong validation.
- remove_accept_encoding_header
(bool) When this field is
true, removesAccept-Encodingfrom the request headers before dispatching the request to the upstream so that responses do not get compressed before reaching the filter.Attention
To avoid interfering with other compression filters in the same chain, use this option in the filter closest to the upstream.
- runtime_enabled
(config.core.v3.RuntimeFeatureFlag) Runtime flag that controls whether the filter is enabled. When this field is
false, the filter will operate as a pass-through filter, unless overridden byCompressorPerRoute. If this field is not specified, the filter is enabled by default.
- compressor_library
(config.core.v3.TypedExtensionConfig, REQUIRED) A compressor library to use for compression.
Tip
This extension category has the following known extensions:
The following extensions are available in contrib images only:
- request_direction_config
(extensions.filters.http.compressor.v3.Compressor.RequestDirectionConfig) Configuration for request compression. If this field is not specified, request compression is disabled.
- response_direction_config
(extensions.filters.http.compressor.v3.Compressor.ResponseDirectionConfig) Configuration for response compression. If this field is not specified, response compression is enabled.
Attention
When this field is set, duplicate deprecated fields of the
Compressormessage, such ascontent_length,content_type,disable_on_etag_header,remove_accept_encoding_header, andruntime_enabled, are ignored.Additionally, all statistics related to response compression will be rooted in
<stat_prefix>.compressor.<compressor_library.name>.<compressor_library_stat_prefix>.response.*instead of<stat_prefix>.compressor.<compressor_library.name>.<compressor_library_stat_prefix>.*.
- choose_first
(bool) When this field is
true, this compressor is preferred when q-values inAccept-Encodingare equal. If multiple compressor filters setchoose_firsttotrue, the last one in the filter chain is chosen.
extensions.filters.http.compressor.v3.Compressor.CommonDirectionConfig
[extensions.filters.http.compressor.v3.Compressor.CommonDirectionConfig proto]
{
"enabled": {...},
"min_content_length": {...},
"content_type": []
}
- enabled
(config.core.v3.RuntimeFeatureFlag) Runtime flag that controls whether compression is enabled for the direction this common config is applied to. When this field is
false, the filter will operate as a pass-through filter in the chosen direction, unless overridden byCompressorPerRoute. If this field is not specified, the filter will be enabled.
- min_content_length
(UInt32Value) Minimum value of the
Content-Lengthheader in request or response messages (depending on the direction this common config is applied to), in bytes, that will trigger compression. Defaults to 30.
- content_type
(repeated string) Set of strings that allows specifying which mime-types yield compression; e.g.,
application/json,text/html, etc.When this field is not specified, compression will be applied to these following mime-types and their synonyms:
application/javascriptapplication/jsonapplication/xhtml+xmlimage/svg+xmltext/csstext/htmltext/plaintext/xml
extensions.filters.http.compressor.v3.Compressor.RequestDirectionConfig
[extensions.filters.http.compressor.v3.Compressor.RequestDirectionConfig proto]
Configuration for filter behavior on the request direction.
{
"common_config": {...}
}
extensions.filters.http.compressor.v3.Compressor.ResponseDirectionConfig
[extensions.filters.http.compressor.v3.Compressor.ResponseDirectionConfig proto]
Configuration for filter behavior on the response direction.
{
"common_config": {...},
"disable_on_etag_header": ...,
"remove_accept_encoding_header": ...,
"uncompressible_response_codes": [],
"status_header_enabled": ...
}
- disable_on_etag_header
(bool) When this field is
true, disables compression when the response contains anETagheader. When this field isfalse, the filter will preserve weakETagvalues and remove those that require strong validation.
- remove_accept_encoding_header
(bool) When this field is
true, removesAccept-Encodingfrom the request headers before dispatching the request to the upstream so that responses do not get compressed before reaching the filter.Attention
To avoid interfering with other compression filters in the same chain, use this option in the filter closest to the upstream.
- uncompressible_response_codes
(repeated uint32) Set of response codes for which compression is disabled; e.g., 206 Partial Content should not be compressed.
- status_header_enabled
(bool) If true, the filter adds the
x-envoy-compression-statusresponse header to indicate whether the compression occurred and, if not, provide the reason why. The header’s value format is<encoder-type>;<status>[;<additional-params>], where<status>isCompressedor the reason compression was skipped (e.g.,ContentLengthTooSmall). When this field is enabled, the compressor filter alters the order of the compression eligibility checks to report the most valid reason for skipping the compression.
extensions.filters.http.compressor.v3.ResponseDirectionOverrides
[extensions.filters.http.compressor.v3.ResponseDirectionOverrides proto]
Per-route overrides of ResponseDirectionConfig. Anything added here should be optional,
to allow overriding arbitrary subsets of configuration. Omitted fields must have no effect.
{
"remove_accept_encoding_header": {...}
}
- remove_accept_encoding_header
(BoolValue) If set, overrides the filter-level remove_accept_encoding_header.
extensions.filters.http.compressor.v3.CompressorOverrides
[extensions.filters.http.compressor.v3.CompressorOverrides proto]
Per-route overrides. As per-route overrides are needed, they should be
added here, mirroring the structure of Compressor. All fields should be
optional, to allow overriding arbitrary subsets of configuration.
{
"response_direction_config": {...},
"compressor_library": {...}
}
- response_direction_config
(extensions.filters.http.compressor.v3.ResponseDirectionOverrides) If present, response compression is enabled.
- compressor_library
(config.core.v3.TypedExtensionConfig) A compressor library to use for compression. If specified, this overrides the filter-level
compressor_libraryconfiguration for this route.
extensions.filters.http.compressor.v3.CompressorPerRoute
[extensions.filters.http.compressor.v3.CompressorPerRoute proto]
{
"disabled": ...,
"overrides": {...}
}
- disabled
(bool) If set, the filter will operate as a pass-through filter. Overrides
Compressor.runtime_enabledandCommonDirectionConfig.enabled.
- overrides
(extensions.filters.http.compressor.v3.CompressorOverrides) Per-route overrides. Fields set here will override corresponding fields in
Compressor.