envoyproxy/envoy

gzip filter: support chunked transfer encoding

Open

#6632 aperta il 18 apr 2019

Vedi su GitHub
 (13 commenti) (4 reazioni) (0 assegnatari)C++ (5373 fork)batch import
enhancementhelp wanted

Metriche repository

Star
 (27.997 star)
Metriche merge PR
 (Merge medio 8g) (378 PR mergiate in 30 g)

Descrizione

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

Guida contributor