-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Headers and timeouts for streaming RPCs #1715
Comments
For timeouts, I can probably keep the |
Timeouts specifically can be controlled with the Where do you want to add the headers/trailers? The gRPC gateway will translate any headers you prefix with |
After a short slack discussion: My current solution/workaround for configuring different default-timeouts for unary and streaming RPCs: |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
📚 Documentation
I'm using grpc-gateway behind an nginX-proxy and want to provide streaming support from server-to-client via the API.
The protocol works pretty flawless after some hickups, but there's one issue I'm not sure how to correctly solve:
Streaming only works if proxies are not buffering the responses. As soon as the gateway calls
Flush()
on thehttp.ResponseWriter
, the http-client/browser should be able to read the line.By default, nginX performs buffering (which is a good thing), and this can be controlled via http headers: http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffering
What's the best way to set the
X-Accel-Buffering
response-header tooff
for streaming-RPCs only? Inside an http-interceptor, I don't know if the called method returns a stream or not. Inside the grpc-client interceptor I don't have access to thehttp.ResponseWriter
(I could get access to it by storing it incontext.Context
, which is an ugly workaround).(I could propably use a combination of an grpc-client interceptor, grpc header-metadata and OutgoingHeaderMatcher to get it working, but this it's also ugly)
I have a similar problem with API-Timeouts:
For unary gRPC-calls I want a timeout of 10 seconds (configurable via
runtime.DefaultContextTimeout
). But for streaming gRPCs a timeout doesn't really make sense, and I don't want the client/browser to always send a timeout-header.Questions + Documentation:
Documentation:
runtime.DefaultContextTimeout
is not documentedThe text was updated successfully, but these errors were encountered: