grpc/grpc-dotnet

HTTP/1.1 with gRPC-Web not working

leononame opened this issue · 0 comments

What version of gRPC and what language are you using?

I'm using C# with .NET 8.0 on ASP.NET Core and Grpc.AspNetCore.* packages 2.65.

What operating system (Linux, Windows,...) and version?

Linux (Fedora 40, Linux 6.10.6)

What runtime / compiler are you using (e.g. .NET Core SDK version dotnet --info)

8.0.107

.NET SDK:
 Version:           8.0.107
 Commit:            1bdaef7265
 Workload version:  8.0.100-manifests.43c23f91

Runtime Environment:
 OS Name:     fedora
 OS Version:  40
 OS Platform: Linux
 RID:         fedora.40-x64
 Base Path:   /usr/lib64/dotnet/sdk/8.0.107/

.NET workloads installed:
 Workload version: 8.0.100-manifests.43c23f91
There are no installed workloads to display.

Host:
  Version:      8.0.7
  Architecture: x64
  Commit:       2aade6beb0

.NET SDKs installed:
  6.0.133 [/usr/lib64/dotnet/sdk]
  7.0.118 [/usr/lib64/dotnet/sdk]
  8.0.107 [/usr/lib64/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.33 [/usr/lib64/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.18 [/usr/lib64/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.7 [/usr/lib64/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.33 [/usr/lib64/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.18 [/usr/lib64/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.7 [/usr/lib64/dotnet/shared/Microsoft.NETCore.App]

What did you do?

I'm building a service with gRPC-Web. gRPC-Web is supposed tu support HTTP/1.1, and the .NET documentation for it also hints at that: https://learn.microsoft.com/en-us/aspnet/core/grpc/grpcweb?view=aspnetcore-8.0#http-protocol

gRPC-Web, however, works with both HTTP/1.1 and HTTP/2. Some platforms, such as UWP or Unity, can't use HTTP/2. To support all client apps, configure the server to enable HTTP/1.1 and HTTP/2.

I have started an empty new project with gRPC, added and enabled gRPC-Web and set Http1AndHttp2 on Kestrel. Here is an example repository.

What did you expect to see?

Executing an HTTP/1.1 request should work

What did you see instead?

curl 'https://localhost:7060/greet.Greeter/SayHello' -H 'Content-Type: application/grpc' -X POST -v --insecure --http1.1

results in the response:

< Grpc-Message: Request protocol 'HTTP/1.1' is not supported.