envoyproxy/envoy

gzip filter: support chunked transfer encoding

Open

#6.632 geöffnet am 18. Apr. 2019

Auf GitHub ansehen
 (13 Kommentare) (4 Reaktionen) (0 zugewiesene Personen)C++ (5.373 Forks)batch import
enhancementhelp wanted

Repository-Metriken

Stars
 (27.997 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 8T) (378 gemergte PRs in 30 T)

Beschreibung

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: <host-name>
User-Agent: <user-agent>
Accept: application/grpc-web-text
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Referer: <referer>
authorization: <auth-value>
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: <date>
server: <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

Contributor Guide