dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.34k stars 9.98k forks source link

http2 does not support nttp requests #13144

Closed nikitawow closed 5 years ago

nikitawow commented 5 years ago

The web server does not accept HTTP requests when using the settings for EndpointDefaults: Protocols: Http2.

To Reproduce

I use an example for a grpc server: https://github.com/aspnet/AspNetCore.Docs/tree/master/aspnetcore/tutorials/grpc/grpc-start/sample/GrpcGreeter With the changed host: http://localhost:5000 And add standard healtcheck.

GRPC requests are successful. However HTTP with an error: ERR_INVALID_HTTP_RESPONSE . Screenshot: https://s.mail.ru/FfM9/Bp5NCLGxM

ASP.NET Core 3 preview 7 Visual Studio 2019 Windows 10

A similar question was asked in a bug: https://github.com/aspnet/AspNetCore/issues/9847

To simplify the work of services, I do not want to depend on SSL certificates. And therefore it is important to raise the GRPC and healthcheck/metrics/etc on http:// .Net Core 2 works successfully

blowdart commented 5 years ago

HTTP/2 is HTTPS only because all user browser agents have refused to do it over HTTP, hence making it a defacto standard. While it's possible to do it with a flag it's only meant for dev work on a Mac, because OSX doesn't support ALPN yet.

analogrelay commented 5 years ago

As per @blowdart 's comment, HTTP/2 is only supported on HTTPS (as it requires the ALPN extension to HTTPS in order to properly negotiate it). Most clients will refuse to allow "clear-text" HTTP/2 connections.

The .NET Core SDK and Visual Studio include SSL certificates for development time and should automatically install those properly so that they are used without additional work from you.

Closing, as this is by design.