-
Notifications
You must be signed in to change notification settings - Fork 689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable gzip compression for additional content type(s) #4345
Comments
@bourquep started a new issue for this discussion so we can track it correctly |
Currently only gzip and brotli compression are supported in Envoy: https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/compression/compression What sort of content compression are you looking for? |
We use Grpc-web (via Envoy via Contour), our payloads are |
Just to clarify: I am not looking to enable other compression algorithms, gzip is fine. I need to configure Envoy to gzip-compress another |
you would have to contour doesnt modify them here: contour/internal/envoy/v3/listener.go Line 235 in 3498b96
seems reasonable to add it by default, esp. since we default to adding the grpc-web filter as well, so if a client says they accept gzip encoding they get it without having to set anything in contour config |
Meanwhile, is there anything I can do to override Envoy's configuration to enable gzip compression for Grpc-web traffic? |
Right now, there is no way to override Envoy's config for this at the moment, sorry. |
If you’re open to submitting a PR we would gladly take it 👍🏽 |
I might give it a shot! |
I gave it a fair try, but I am totally illiterate in Go and in Envoy configuration schema. I'm afraid I'd break something if I ventured any further. 🤷 |
I gave it another try, and I have something that looks in order: https://github.com/Studyo/contour/commit/79ba90776b88ed201b20864860c37cf0cf718287 But I'm not sure about having to copy-paste the headers in each test though, and I couldn't figure out how to write feature and/or end-to-end tests for it. I will only be to test it in my cluster after I have upgraded Contour to the latest version, which should be soon. In other words, I have a commit but not a PR yet. 🤷♂️ |
I have back ported the commit to Contour 1.14.1 (the version we are using in prod), and tested with an updated image. Unfortunately, it doesn't work - the Grpc-web responses are not compressed. I tried moving the grpcweb filter above the compressor filter, still no luck. Then I researched a bit more and found this: envoyproxy/envoy#6632 Looks like Envoy isn't able to compress Grpc-web responses after all. |
Oh, that sucks, sorry @bourquep. Let's mark this as blocked on Envoy for now then. |
There is hope: I upgraded Contour to 1.15.1 (was on 1.14.1), then applied my patch to enable gzip on Grpc-web payloads, and it works! |
Nice! Yeah the Envoy 1.18 release notes mention |
Unfortunately Contour 1.15 is a pretty old release and I'm not sure we will backport the change that far, but if you're willing to submit a PR we can at least enable it in |
@sunjayBhatia Indeed, I did not expect you to backport, I just wanted to be able to test my patch with the release that I have in production. Do you think that my commit mentioned above is enough for a PR? I haven't been able to add any feature or e2e tests... |
@sunjayBhatia I've just submitted #4403 for this! |
…4403) When Envoy serves as a `grpc-web` gateway, HTTP requests/responses use one of the [documented content-type](https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-WEB.md#protocol-differences-vs-grpc-over-http2), for which gzip compression is _not_ enabled by [default in Envoy](https://www.envoyproxy.io/docs/envoy/v1.17.4/api-v2/config/filter/http/compressor/v2/compressor.proto#envoy-api-msg-config-filter-http-compressor-v2-compressor). This MR adds the `grpc-web` content types to Envoy's default ones, so they are gzip-compressed by default. Fixes #4345 Signed-off-by: Pascal Bourque <pascal@studyo.co>
If I wanted to enable compression for another content type, how should I proceed?
Originally posted by @bourquep in #731 (comment)
The text was updated successfully, but these errors were encountered: