Skip to content
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

Is is possible to "disable_on_etag_header: true" to envoy compressor extension #4679

Open
boatmisser opened this issue Aug 19, 2022 · 4 comments
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature.

Comments

@boatmisser
Copy link

Can I pass disable_on_etag_header: true to envoy; preferably by HTTPProxy route; but envoy as whole would be acceptable.
Searched docs from both contour and envoy and haven't had much luck.
Thanks

Environment:

  • Contour version: v1.18.3
  • Kubernetes version: (use kubectl version): v1.21.14-eks-18ef993
@boatmisser boatmisser added kind/question Categorizes an issue as a user question. lifecycle/needs-triage Indicates that an issue needs to be triaged by a project contributor. labels Aug 19, 2022
@sunjayBhatia
Copy link
Member

could you add a little more detail to the description on why this feature is useful to you? just for context for anyone picking this up and to add some justification

seems reasonable as a feature to add

see here where we configure the compressor filter:

&http.HttpFilter{
Name: "compressor",
ConfigType: &http.HttpFilter_TypedConfig{
TypedConfig: protobuf.MustMarshalAny(&envoy_compressor_v3.Compressor{
CompressorLibrary: &envoy_core_v3.TypedExtensionConfig{
Name: "gzip",
TypedConfig: protobuf.MustMarshalAny(
&envoy_gzip_v3.Gzip{},
),
},
ResponseDirectionConfig: &envoy_compressor_v3.Compressor_ResponseDirectionConfig{
CommonConfig: &envoy_compressor_v3.Compressor_CommonDirectionConfig{
ContentType: []string{
// Default content-types https://github.com/envoyproxy/envoy/blob/e74999dbdb12aa4d6b7a5d62d51731ea86bf72be/source/extensions/filters/http/compressor/compressor_filter.cc#L35-L38
"text/html", "text/plain", "text/css", "application/javascript", "application/x-javascript",
"text/javascript", "text/x-javascript", "text/ecmascript", "text/js", "text/jscript",
"text/x-js", "application/ecmascript", "application/x-json", "application/xml",
"application/json", "image/svg+xml", "text/xml", "application/xhtml+xml",
// Additional content-types for grpc-web https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-WEB.md#protocol-differences-vs-grpc-over-http2
"application/grpc-web", "application/grpc-web+proto", "application/grpc-web+json", "application/grpc-web+thrift",
"application/grpc-web-text", "application/grpc-web-text+proto", "application/grpc-web-text+thrift",
},
},
},
}),
},
},

we will likely have to add this feature as a global configuration, since the compressor filter is per Envoy HTTPConnectionManager and for HTTP virtualhosts there is only one (though there are many filter chains for HTTPS virtualhosts)

the global flag will probably go somewhere here:

type EnvoyListenerConfig struct {
(and accompanying config file location since that hasnt been deprecated yet)

let us know if you are willing to contribute, PRs are welcome! otherwise we will get this in the backlog and prioritized

@sunjayBhatia sunjayBhatia added kind/feature Categorizes issue or PR as related to a new feature. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. and removed kind/question Categorizes an issue as a user question. lifecycle/needs-triage Indicates that an issue needs to be triaged by a project contributor. labels Aug 22, 2022
@boatmisser
Copy link
Author

thanks for the reply
we have a couple of issues; the first is Etag being stripped when envoy compresses the response.
The other is that we have a WAF outside of our cluster that performs some security checking on the response; this means that the WAF has to de-compress, process, then re-compress.
So this first issue could be worked around with using disable_on_etag_header: true; and this is the one we are concerned about.
However if we can't pass config to envoy; is it possible to disable envoy compression entirely?

@sunjayBhatia
Copy link
Member

you can disable compression if your response content-type is not in this set:

ContentType: []string{
// Default content-types https://github.com/envoyproxy/envoy/blob/e74999dbdb12aa4d6b7a5d62d51731ea86bf72be/source/extensions/filters/http/compressor/compressor_filter.cc#L35-L38
"text/html", "text/plain", "text/css", "application/javascript", "application/x-javascript",
"text/javascript", "text/x-javascript", "text/ecmascript", "text/js", "text/jscript",
"text/x-js", "application/ecmascript", "application/x-json", "application/xml",
"application/json", "image/svg+xml", "text/xml", "application/xhtml+xml",
// Additional content-types for grpc-web https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-WEB.md#protocol-differences-vs-grpc-over-http2
"application/grpc-web", "application/grpc-web+proto", "application/grpc-web+json", "application/grpc-web+thrift",
"application/grpc-web-text", "application/grpc-web-text+proto", "application/grpc-web-text+thrift",
},

see envoy field documentation: https://www.envoyproxy.io/docs/envoy/latest/api-v3/extensions/filters/http/compressor/v3/compressor.proto#envoy-v3-api-field-extensions-filters-http-compressor-v3-compressor-content-type

@tsaarni
Copy link
Member

tsaarni commented Aug 14, 2024

xref #6511

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests

3 participants