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

grpcwebproxy incompatibility with aspnet core #404

Closed
FabianTerhorst opened this issue May 2, 2019 · 7 comments
Closed

grpcwebproxy incompatibility with aspnet core #404

FabianTerhorst opened this issue May 2, 2019 · 7 comments

Comments

@FabianTerhorst
Copy link

Versions of relevant software used
latest grpcwebproxy binary for osx.

What happened
the http request to the grpc server contains a invalid connection header field.

What you expected to happen
A valid http/2 request.

How to reproduce it (as minimally and precisely as possible):
Start a aspnet core grpc server (0.1.20).
Start the proxy.
Send grpc request from browser to the proxy.
Server will throw a exception:

Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.Http2ConnectionErrorException: HTTP/2 connection error (PROTOCOL_ERROR): Request headers contain connection-specific header field.
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.Http2Connection.ValidateHeader(Span`1 name, Span`1 value)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.Http2Connection.OnHeader(Span`1 name, Span`1 value)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.HPack.HPackDecoder.ProcessHeaderValue(IHttpHeadersHandler handler)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.HPack.HPackDecoder.OnByte(Byte b, IHttpHeadersHandler handler)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.HPack.HPackDecoder.Decode(ReadOnlySequence`1 data, Boolean endHeaders, IHttpHeadersHandler handler)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.Http2Connection.DecodeHeadersAsync(Boolean endHeaders, ReadOnlySequence`1 payload)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.Http2Connection.ProcessHeadersFrameAsync[TContext](IHttpApplication`1 application, ReadOnlySequence`1 payload)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.Http2Connection.ProcessFrameAsync[TContext](IHttpApplication`1 application, ReadOnlySequence`1 payload)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.Http2Connection.ProcessRequestsAsync[TContext](IHttpApplication`1 application)

Line where the exception is throwed: https://github.com/aspnet/AspNetCore/blob/master/src/Servers/Kestrel/Core/src/Internal/Http2/Http2Connection.cs#L1165

Environment:

  • OS 0sx 10.14.4:
@johanbrandhorst
Copy link
Contributor

The grpcwebproxy just uses the Go gRPC stack to make downstream requests. Can you reproduce this issue with a Go gRPC client?

@johanbrandhorst
Copy link
Contributor

For the curious: it seems connection is a reserved header, and te too, but only if it doesn't appear in a trailer.

@FabianTerhorst
Copy link
Author

No i can't reproduce it with the go grpc client. I have switched to envoy now which is working

@johanbrandhorst
Copy link
Contributor

Interesting. Are you setting the connection header in the requests from the front-end? I don't think the proxy sets it.

@FabianTerhorst
Copy link
Author

I only used the generated service method without specifying any options and without any meta data.

@FabianTerhorst
Copy link
Author

I was able to resolve it by using port 8443 with https instead of 8080 with http on localhost.

@johanbrandhorst
Copy link
Contributor

Closing this as it is unlikely to be a bug in the proxy

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

No branches or pull requests

2 participants