envoyproxy / envoyproxy/envoy

gzip filter: support chunked transfer encoding

Open
#6,632 13 comments 4 reactions 0 assignees View on GitHub
enhancement help wanted
Dominant language
C++
Stars
28.9k
Forks
5.6k
Avg merge
1d 20h
Merged PRs (30d)
437

Description

*Title*: grpc-web: compress response for service methods with non-streaming response

*Description*:
I have a setup with a frontend making requests to our backend using grpc/grpc-web[^1] via the envoy grpc-web filter.
Currently a response to a simple request-response service method is never compressed, but this is accepted by the grpc-web client and thus should be possible.
I have enabled the `envoy.gzip` plugin and added `application/grpc-web-text+proto` and `application/grpc-web-text` in `content_types`.
The content being sent by the grpc-web protocol is Base64 encoded proto bytes[^2], meaning the reduction in response size should be significant.

The request headers:

Host:
User-Agent:
Accept: application/grpc-web-text
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Referer:
authorization:
Content-Type: application/grpc-web-text
X-User-Agent: grpc-web-javascript/0.1
X-Grpc-Web: 1
Content-Length: 12
DNT: 1
Connection: keep-alive
TE: Trailers

The response headers:

HTTP/2.0 200 OK
content-type: application/grpc-web-text+proto
grpc-encoding: identity
grpc-accept-encoding: gzip
x-envoy-upstream-service-time: 83
date:
server:
strict-transport-security: max-age=31536000
X-Firefox-Spdy: h2

The only missing requirement for the gzip filter to compress a response[^3] seems to be a missing content length. Unfortunately I can't see the response returned by the various filters (even with `--log-level=trace`) so I can't be sure this is what is missing.

*Relevant Links*
* [^1] https://github.com/grpc/grpc-web
* [^2] Unless the grpc services are compiled with `mode=grpcweb` but that completely disables all streaming calls (see [README.md](https://github.com/grpc/grpc-web#wire-format-mode))
* [^3] https://www.envoyproxy.io/docs/envoy/latest/configuration/http_filters/gzip_filter

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.