TL; DR: here’s a code snippet to turn on gzip compression for Istio’s ingress gateway, using Envoy filter. Tested with Istio 1.16 and Kubernetes 1.26.
apiVersion: networking.istio.io/v1alpha3 kind: EnvoyFilter metadata: name: ingressgateway-compresser namespace: istio-system spec: workloadSelector: labels: istio: ingressgateway configPatches: - applyTo: HTTP_FILTER match: context: GATEWAY 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 # for more powerful brotli compressor, use the following lines # '@type': type.googleapis.com/envoy.extensions.compression.brotli.compressor.v3.Brotli # quality: 4 remove_accept_encoding_header: true
To test it with curl:
$ curl -is --compressed https://raynix.info |grep -i content-encoding content-encoding: gzip
🙂