Skip to content

Instantly share code, notes, and snippets.

@Stono
Last active December 17, 2024 18:39
Show Gist options
  • Save Stono/6385d379c7e24ac32fcf96e1310e7227 to your computer and use it in GitHub Desktop.
Save Stono/6385d379c7e24ac32fcf96e1310e7227 to your computer and use it in GitHub Desktop.
Gzip compression EnvoyFilter
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
annotations:
description: Ensures all Sidecars are capable of returning a gzip response
name: Enable Gzip
name: enable-gzip
namespace: istio-system
spec:
configPatches:
- applyTo: HTTP_FILTER
match:
context: SIDECAR_INBOUND
listener:
filterChain:
filter:
name: envoy.filters.network.http_connection_manager
subFilter:
name: envoy.filters.http.router
patch:
operation: INSERT_BEFORE
value:
name: envoy.filters.http.compressor
typed_config:
'@type': type.googleapis.com/envoy.extensions.filters.http.compressor.v3.Compressor
compressor_library:
name: text_optimized
typed_config:
'@type': type.googleapis.com/envoy.extensions.compression.gzip.compressor.v3.Gzip
chunk_size: 4096
encoder_mode: DEFAULT
input_block_bits: 24
quality: 5
window_bits: 15
request_direction_config:
common_config:
enabled:
default_value: false
runtime_key: request_direction_config_enabled
response_direction_config:
common_config:
content_type:
- application/hal+json
- application/atom+xml
- application/javascript
- application/x-javascript
- application/json
- application/rss+xml
- application/vnd.ms-fontobject
- application/x-font-ttf
- application/x-web-app-manifest+json
- application/xhtml+xml
- application/xml
- font/opentype
- image/svg+xml
- image/x-icon
- text/css
- text/javascript
- text/html
- text/plain
- text/xml
- text/x-component
enabled:
default_value: true
runtime_key: response_direction_config_enabled
min_content_length: 860
remove_accept_encoding_header: true
priority: -10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment