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
Forwarding Connection header breaks after updating grpc/grpc-go to 1.42.0 #2447
Comments
Hm, this is curious, what should the behavior be here? Should the grpc-gateway strip these headers? I'm surprised we're forwarding this header, it should only forward explicitly added headers or permanent IANA headers (listed here: grpc-gateway/runtime/context.go Line 261 in 094a6fe
|
ok, I'd like to submit a PR for it later. |
I found that my server breaks because i was using
But for a further concern, is it a good idea that provides a backward-Compatible header matcher, which drops "malformed" headers for grpc and returns others headers as-is? It can be implemented like this: func PassThroughHeaderMatcher(key string) (string, bool) {
key = textproto.CanonicalMIMEHeaderKey(key)
if isMalformedHTTPHeader(key) {
return MetadataPrefix + key, true
} else {
return key, true
}
} Thanks very much. |
That is an interesting question. It would be nice to automatically help users who might suffer from this problem, but I'm also hesitant to do this implicitly. Maybe we could detect if the header matcher would match |
Agree. I tend to add a pre-matcher to match |
I think we can just try running any matcher with the |
Ok i am working on it. |
Fixed in #2455 |
🐛 Bug Report
grpc-gateway breaks after updating
grpc/grpc-go
to 1.42.0After the update introduced by this PR, it will report
stream terminated by RST_STREAM with error code: PROTOCOL_ERROR
ifconnection
in headers, which breaks down all of the http connections that comes withconnect:keep-alive
To Reproduce
Step 1:
Update
google.golang.org/grpc
tov1.42.0
in go modStep 2:
invoke http request with header
connect:keep-alive
Expected behavior
grpc-gateway works well or reports warning, instead of returning
PROTOCOL_ERROR
Actual Behavior
it returns
stream terminated by RST_STREAM with error code: PROTOCOL_ERROR
Your Environment
go.mod:
google.golang.org/grpc v1.42.0
,github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0
The text was updated successfully, but these errors were encountered: