-
Notifications
You must be signed in to change notification settings - Fork 756
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
gRPC has an issue when Kestrel set to Http1AndHttp2 with unsecure urls. #979
Comments
This is an expected situation. Http1AndHttp2 requires TLS for ALPN protocol negotiation. You either need separate ports for HTTP/1.1 and HTTP/2, or use TLS. |
James, thanks so much for responding. First, let me say "Thanks for your efforts in the community." I believe I understand what you are saying w/r/t gRPC and why that now fails with Http1AndHttp2. However, I would expect MapGet("/") would succeed with an unsecure URL and HTTP/2. It succeeds with HTTPS and HTTP/2. So that seems odd to me, but that is not a gRPC issue. Any thoughts on this? ... or which group I should take this too? My hope is that I could get this to work over one port so that I don't have to open two ports. |
Closing the issue |
Browsers require TLS with HTTP/2 |
hi @ChiefInnovator |
gRPC has an issue when Kestrel set to Http1AndHttp2 with unsecure urls.
This has to do with unsecure URLs. We are using unsecure URLs because we want to host the gRPC services inside Kubernetes cluster with HTTP. We will support HTTPS at the load balancer and offload the TLS. Additionally, we have a development team that has a mix of Windows and Macs and want to support development on the Mac and cannot use HTTPS with gRPC at the moment due to missing ALPN support on the Mac.
Reference: Unable to start AspNet Core gRPC on Mac OS
We are trying to host both gRPC services and would like to host MapGet endpoints. Interestingly, the gRPC template does exactly this. When you use the sample out-of-the-box, it works. But when we change to use an unsecure applicationUrl in launchSettings things stop working.
The MapGet("/") fails with an unsecure URL (ex. http://localhost:5000). We are able to get the MapGet("/") to work when we change the protocol from Http2 to Http1AndHttp2. Conversely, our gRPC services fails when Kestrel supports both Http1AndHttp2 with an unsecure applicationUrl.
Scenario #1 - Secure URL (https://localhost:5001), Http2 Protocol
MapGet Succeeds, gRPC Succeeds
Scenario #2 - Unsecure URL (http://localhost:5000), Http2 Protocol
MapGet Fails, gRPC Succeeds
Scenario #3 - Unsecure URL (http://localhost:5000), Http1AndHttp2 Protocol
MapGet Succeeds, gRPC Fails
What version of gRPC and what language are you using?
Testing with 2.29.0 and 2.30-pre1
What operating system (Linux, Windows,...) and version?
Windows 10
What runtime / compiler are you using (e.g. .NET Core SDK version
dotnet --info
).NET Core SDK (reflecting any global.json):
Version: 3.1.301
Commit: 7feb845744
Runtime Environment:
OS Name: Windows
OS Version: 10.0.20161
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.301\
Host (useful for support):
Version: 3.1.5
Commit: 65cd789777
.NET Core SDKs installed:
2.1.806 [C:\Program Files\dotnet\sdk]
2.2.207 [C:\Program Files\dotnet\sdk]
2.2.402 [C:\Program Files\dotnet\sdk]
3.0.103 [C:\Program Files\dotnet\sdk]
3.1.301 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.19 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.19 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0-preview9.19424.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.0-preview3.19555.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.19 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0-preview9-19423-09 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.0-preview3.19553.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.0.0-preview9-19423-09 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.0-preview3.19553.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
What did you do?
Start with ASP.NET Core gRPC template.
dotnet new grpc -o HelloGrpc
Change launchSettings to unsecure URL breaks MapGet
Change Kestrel protocols in appsettings.json breaks gRPC
"Kestrel": {
"EndpointDefaults": {
"Protocols": "Http1AndHttp2"
}
},
What did you expect to see?
MapGet should just work when using an insecure URL and protocol Http2.
gRPC should just work when using an insecure URL and protocol Http1AndHttp2
What did you see instead?
We see two failures, one with MapGet and one with gRPC.
Anything else we should know about your project / environment?
We are trying to get this working on Windows first, then on the Mac.
The text was updated successfully, but these errors were encountered: