Open arkodg opened 10 months ago
BackendTrafficPolicy
seems like a good home for compression
, and Envoy does have support for per route compression filters
For refs here is a working patch for HTTPS, (warning the path to patch is different for HTTP "/default_filter_chain/filters/0/typed_config/http_filters/0"
)
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: EnvoyPatchPolicy
metadata:
name: compressor-patch-policy
namespace: envoy-gateway-system
spec:
targetRef:
group: gateway.networking.k8s.io
kind: Gateway
name: eg
namespace: envoy-gateway-system
type: JSONPatch
jsonPatches:
- type: "type.googleapis.com/envoy.config.listener.v3.Listener"
name: envoy-gateway-system/eg/https
operation:
op: add
path: "/filter_chains/0/filters/0/typed_config/http_filters/0"
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"
compression_level: BEST_SPEED
compression_strategy: DEFAULT_STRATEGY
memory_level: 8
window_bits: 15
chunk_size: 4096
response_direction_config:
remove_accept_encoding_header: true
common_config:
enabled:
default_value: true
runtime_key: response_direction_config_enabled
content_type:
- "application/javascript"
- "application/json"
- "application/x-web-app-manifest+json"
- "application/xhtml+xml"
- "application/xml"
- "font/opentype"
- "image/svg+xml"
- "image/x-icon"
- "text/css"
- "text/html"
- "text/plain"
- "text/xml"
min_content_length: 60
request_direction_config:
common_config:
enabled:
default_value: false
runtime_key: request_direction_config_enabled
you should see a response with an content-encoding: gzip
header for an HTTP/1.1 request with a Accept-Encoding: deflate, gzip
header.
@arkodg @akhenakh are you going to work on it? I'm willing to help on it, thanks!
go for it @soulxu ! recommend starting with the API PR before implementing the logic :)
@arkodg got it, thanks!
Interesting discussion here on compression performance and buffer sizing. Should we make per_connection_buffer_limit_bytes
configurable as part of this issue?
I can also think of future use cases that include buffering filters (ext-auth with body, WAF, ext-proc, lua, buffer) that should be part of the Envoy Gateway scope and require buffer size tuning.
This issue has been automatically marked as stale because it has not had activity in the last 30 days.
Would it be hard to add brotli compression with a fallback to gzip if the HTTP client only supports gzip?
This issue has been automatically marked as stale because it has not had activity in the last 30 days.
@soulxu still working on this one ?, the API is in, but the implementation is still left
Hi, we are also interested in compression support in CRDs.
Envoy supporting Brotli natively was one of the reasons we chose it as our API Gateway over Kong (which has since added Brotli support)
@soulxu still working on this one ?, the API is in, but the implementation is still left
@arkodg I will give a try this two weeks.
thanks for the update @soulxu ! , lets keep this in the v1.1 milestone for now
This issue has been automatically marked as stale because it has not had activity in the last 30 days.
+1
Any updates on this @soulxu ?
hey @soulxu are you still planning on working on this one ? would be great if you can, completely okay if not, will unassign so someone from the community can take this forward
@arkodg sorry, I failed on get a chance working on it, please free feel to assign anyone interesting it.
np thanks for the update @soulxu, unassgning
Description: Support Payload Compression
[optional Relevant Links:]
Envoy - https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/compression/compression.html#compression
Upstream Issue - https://github.com/kubernetes-sigs/gateway-api/issues/1799
Relates to https://envoyproxy.slack.com/archives/C03E6NHLESV/p1705084783438099