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

#4238 Added the WithWriteContentLength ServerMuxOption #4239

Closed

Conversation

joshgarnett
Copy link
Contributor

This PR Fixes #4238. The GRPC Gateway is currently relying on the default behavior of w.Write, which will only set Content-Length on small messages by default. For users who are running GRPC Gateway behind a CDN (i.e. CloudFront), this means they cannot take advantage of automatic compression handling for client requests.

Always setting the Content-Length header, isn't a great option, as middleware/forwardResponseOptions may be mutating the response and could lead to an invalid Content-Length being printed. While a forwardResponseOption could be used to write Content-Length, this would result in a double marshaling of the protobuf message and could potentially be incorrect in special cases.

This fix should be backwards compatible and avoids the downsides discussed above.

@joshgarnett
Copy link
Contributor Author

Going to recreate the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Content-Length not set in ForwardResponseMessage
1 participant