question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GRPC :scheme pseudo-header passed from proxy/loadbalancer causes ConnectionAbortedException

See original GitHub issue

Describe the bug

Grpc kestrel .net 5 sample app greeter is running in k8s under http transport, an AWS network load balancer terminates SSL and sends request to the app with :scheme pseudo-header set to “https”, but the actual transport is “http” results in this error - Trace id "0HM6QO8HEK1N9:00000001": HTTP/2 stream error "PROTOCOL_ERROR". A Reset is being sent to the stream. Microsoft.AspNetCore.Connections.ConnectionAbortedException: The request :scheme header 'https' does not match the transport scheme 'http'.

The ask here is to be less stringent on validating on the :schema pseudo header, Go lang sample apps works fine.

To Reproduce

Deploy any sample grpc app from here - https://github.com/grpc/grpc-dotnet/tree/master/examples to k8s, setup the service type loadbalancer using AWS NLB. Test with grpcurl client.

Exceptions (if any)

Microsoft.AspNetCore.Connections.ConnectionAbortedException: The request :scheme header 'https' does not match the transport scheme 'http'.

Further technical details

  • ASP.NET Core version
  • Include the output of dotnet --info
  • The IDE (VS / VS Code/ VS4Mac) you’re running on, and its version

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:41 (21 by maintainers)

github_iconTop GitHub Comments

3reactions
zhuoyangcommented, May 19, 2021

PSA for google cloud run users, google actually fixed this issue on their side

https://issuetracker.google.com/issues/187470251?pli=1

3reactions
jimm1419commented, May 10, 2021

This recently broke me in Cloud Run, I guess GCP updated envoy because it was working fine a couple of weeks ago. Here’s a workaround if anyone needs it:

  1. Download this repo, I use v5 so git clone https://github.com/dotnet/aspnetcore.git && cd aspnetcore && git checkout tags/v5.0.5
  2. git submodule update --init --recursive
  3. Find the file /src/Servers/Kestrel/Core/src/Internal/Http2/Http2Stream.cs and comment out lines 244-250. If not version 5.0.5, it’s the block of code that starts with if (!ReferenceEquals(headerScheme, Scheme) &&, comment that whole if block
  4. build the project - ./build.sh --configuration Release in the root of the project. It had a few errors but the file I needed was built.
  5. Take file aspnetcore/artifacts/bin/Microsoft.AspNetCore.Server.Kestrel.Core/Release/net5.0/Microsoft.AspNetCore.Server.Kestrel.Core.dll and copy it to a folder with the following Dockerfile:
FROM mcr.microsoft.com/dotnet/aspnet:5.0

COPY ./Microsoft.AspNetCore.Server.Kestrel.Core.dll /usr/share/dotnet/shared/Microsoft.AspNetCore.App/5.0.5/

A bit of a pain, but we’re back up on Cloud Run with this …

Read more comments on GitHub >

github_iconTop Results From Across the Web

GRPC on Google Cloud Run : upstream connect error or ...
In turn, this exposes this .NET issue: GRPC :scheme pseudo-header passed from proxy/loadbalancer causes ConnectionAbortedException dotnet/ ...
Read more >
gRPC Load Balancing
This post describes various load balancing scenarios seen when deploying gRPC. If you use gRPC with multiple backends, this document is for you....
Read more >
grpcurl | A handy and universal gRPC command line client
grpcurl is a Go library typically used in Web Services applications. grpcurl has no bugs, it has no vulnerabilities and it has low...
Read more >
gRPC client-side load balancing
Client-side load balancing is a feature that allows gRPC clients to distribute load optimally across available servers.
Read more >
dotnet-docs-samples | .NET code samples used on https - kandi
It seems that my first error I describe is very easy to reproduce. Actually, Google Run fails to run any GRPC query on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found