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

internal/envoy: Enable gzip compression for grpc-web content types. #4403

Merged
merged 3 commits into from
Apr 14, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelogs/unreleased/4403-bourquep-small.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
internal/envoy: Enable gzip compression for grpc-web content types.
9 changes: 9 additions & 0 deletions internal/envoy/v3/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,15 @@ func (b *httpConnectionManagerBuilder) DefaultFilters() *httpConnectionManagerBu
TypeUrl: HTTPFilterGzip,
},
},
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-web#wire-format-mode
"application/grpc-web-text", "application/grpc-web+proto",
},
}),
},
},
Expand Down
108 changes: 108 additions & 0 deletions internal/envoy/v3/listener_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,15 @@ func TestHTTPConnectionManager(t *testing.T) {
TypeUrl: HTTPFilterGzip,
},
},
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-web#wire-format-mode
"application/grpc-web-text", "application/grpc-web+proto",
},
}),
},
}, {
Expand Down Expand Up @@ -528,6 +537,15 @@ func TestHTTPConnectionManager(t *testing.T) {
TypeUrl: HTTPFilterGzip,
},
},
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-web#wire-format-mode
"application/grpc-web-text", "application/grpc-web+proto",
},
}),
},
}, {
Expand Down Expand Up @@ -627,6 +645,15 @@ func TestHTTPConnectionManager(t *testing.T) {
TypeUrl: HTTPFilterGzip,
},
},
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-web#wire-format-mode
"application/grpc-web-text", "application/grpc-web+proto",
},
}),
},
}, {
Expand Down Expand Up @@ -727,6 +754,15 @@ func TestHTTPConnectionManager(t *testing.T) {
TypeUrl: HTTPFilterGzip,
},
},
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-web#wire-format-mode
"application/grpc-web-text", "application/grpc-web+proto",
},
}),
},
}, {
Expand Down Expand Up @@ -826,6 +862,15 @@ func TestHTTPConnectionManager(t *testing.T) {
TypeUrl: HTTPFilterGzip,
},
},
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-web#wire-format-mode
"application/grpc-web-text", "application/grpc-web+proto",
},
}),
},
}, {
Expand Down Expand Up @@ -926,6 +971,15 @@ func TestHTTPConnectionManager(t *testing.T) {
TypeUrl: HTTPFilterGzip,
},
},
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-web#wire-format-mode
"application/grpc-web-text", "application/grpc-web+proto",
},
}),
},
}, {
Expand Down Expand Up @@ -1024,6 +1078,15 @@ func TestHTTPConnectionManager(t *testing.T) {
TypeUrl: HTTPFilterGzip,
},
},
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-web#wire-format-mode
"application/grpc-web-text", "application/grpc-web+proto",
},
}),
},
}, {
Expand Down Expand Up @@ -1123,6 +1186,15 @@ func TestHTTPConnectionManager(t *testing.T) {
TypeUrl: HTTPFilterGzip,
},
},
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-web#wire-format-mode
"application/grpc-web-text", "application/grpc-web+proto",
},
}),
},
}, {
Expand Down Expand Up @@ -1223,6 +1295,15 @@ func TestHTTPConnectionManager(t *testing.T) {
TypeUrl: HTTPFilterGzip,
},
},
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-web#wire-format-mode
"application/grpc-web-text", "application/grpc-web+proto",
},
}),
},
}, {
Expand Down Expand Up @@ -1323,6 +1404,15 @@ func TestHTTPConnectionManager(t *testing.T) {
TypeUrl: HTTPFilterGzip,
},
},
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-web#wire-format-mode
"application/grpc-web-text", "application/grpc-web+proto",
},
}),
},
}, {
Expand Down Expand Up @@ -1772,6 +1862,15 @@ func TestAddFilter(t *testing.T) {
TypeUrl: HTTPFilterGzip,
},
},
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-web#wire-format-mode
"application/grpc-web-text", "application/grpc-web+proto",
},
}),
},
},
Expand Down Expand Up @@ -1839,6 +1938,15 @@ func TestAddFilter(t *testing.T) {
TypeUrl: HTTPFilterGzip,
},
},
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-web#wire-format-mode
"application/grpc-web-text", "application/grpc-web+proto",
},
}),
},
},
Expand Down