Replies: 1 comment 1 reply
-
|
Hi! 👋 This is expected behavior: Kestrel refuses HTTP/2 without TLS by default. It’s not a configuration bug. It’s a security enforcement in HTTP/2. ✅ Workarounds:
So there’s no hidden Kestrel setting that lets you combine HTTP/1.1 + HTTP/2 on the same port without TLS in a container - your two-port setup is the recommended approach for cloud scenarios. Hope it helps! |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have an application based on multiple GRPC services (all ASP.NET Core) that works flawlessly locally (via Aspire). Now it's time to go cloud and I'm facing a lot of annoying problems in deploying those services in Azure Container Apps.
The biggest issue is that, when you deploy in containers, regardless of the hosting technology, you don't have TLS in the containers but you use some kind of TLS termination at the boundary. This means that the containers themselves expose their endpoints in plain HTTP.
This works fine with regular REST services but it gets very annoying when working with GRPC services who rely on HTTP2. Especially, if you want to expose both GRPC services and traditional REST endpoints.
Theoretically, you could configure the WebHost via a configuration setting the default listener to accept both HTTP/1.1 and HTTP/2. Something like
But the reality is very different as Kestrel really doesn't want to accept HTTP/2 traffic without TLS and rejects the HTTP/2 traffic. Eventually, after loads of trial and error, the only thing that actually works is listening to the two ports independently.
The first one is the main endpoint for the GRPC traffic. The second one is the one used for the health checks. When combined with the limitations of Azure Container Apps, it means that "debug" REST endpoints I use in non-prod environments are not accessible anymore from outside. This will probably also affect Prometheus but I didn't get that far yet.
So, I'm not sure what to do now. I wish there was a way to force Kestrel to accept HTTP/2 traffic without TLS on the ports specified in
ASPNETCORE_HTTP_PORTS. I don't think it's a protocol limitation. It feels it's just Kestrel being too cautious but unfortunately, containers usually work without TLS.Honestly, I hope I just made a fool of myself with this post because I missed a clearly self-telling setting in the
ConfigureKestreloptions.Beta Was this translation helpful? Give feedback.
All reactions