-
Notifications
You must be signed in to change notification settings - Fork 770
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
Content-length: 0 confuses grpc-web client #1101
Comments
For correctness, should grpc-web filter remove C-L or update C-L to the actual size of the body? |
@Jennnnny Can you please take a first look at this issue? This comes from an internal bug ( b/189801953 |
@stanley-cheung , I posted in #1050 (comment) before seeing this issue. I am experiencing the same problem with the javascript library. Tested with two proxies and have identical results. I would appreciate help with debugging/fixing this. |
Hey all. What's the current status on this and are there any workarounds in the time being? |
I just retried the test case from #1050 (comment) with the latest from this repo and no change. Any guidance? |
I just found the issue and it has nothing to do with the javascript library itself. The CORS pre-flight response has to include In my test cases, with both envoy and grpc-wrapper, I was making the mistake of allowing the @wlhee, can you please try the sample code you have with this small update? If you add |
#1050 (comment) solved it for us. |
I think that this issue can be closed since the actual problems is indeed the response headers and not anything in grpc-web.. I also ran into this issue and Stefan's solution worked for me. |
@RmStorm Thanks for the comment! I'm closing this bug now based on the comment from @RmStorm and @stefannegrea above (thanks both!!). Please feel free to re-open if the issue remains. Thanks! |
A gRPC server could send back a gRPC response without any body, for example, a gRPC error response. However, some server could choose not to use "trailers-only" to send back the "grpc-status". Instead, it still uses "headers", "empty body", "trailers" HTTP/2 frames, and the grpc-status and grpc-message are set in the trailers.
There could be scenario when "content-length: 0" is added to the response header as the body is empty. For example, if the gRPC server is fronted by an envoy, the envoy could add "C-L: 0". See envoyproxy/envoy#5554. An example response looks like this:
For this case, as grpc-web filter doesn't strip content-length nor update content length after it encodes the trailers and puts it into the response body. The output from the filter could confuses the grpc-web client and makes it reject the response.
See a reproduction case in https://github.com/ridedott/grpc-web-cloud-run-issue
And confirm removing content-length header makes the grpc-web client happy: https://github.com/ridedott/grpc-web-cloud-run-issue
The text was updated successfully, but these errors were encountered: