Skip to content

Improve side-by-side configuration of HTTP/1.1 and HTTP/2 endpoints #48436

Open
@JamesNK

Description

@JamesNK

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

ASP.NET Core supports simple configuration of endpoints using environment variables, such as ASPNETCORE_HTTP_PORTS, ASPNETCORE_HTTPS_PORTS, ASPNETCORE_URLS.

However, if an app needs to support HTTP/1.1 and HTTP/2 side-by-side and without TLS, then endpoints need to be manually configured:

Configuring endpoints manually is a wall of complexity that devs hit once they have this requirement. We should make this simple scenario simple to configure.

Require two ports is common in cloud-native apps:

  • Apps don't use TLS to communicate because they're inside a private network, and having TLS certs everywhere is annoying. Therefore they can't use TLS+ALPN for protocol negotiation.
  • Apps need HTTP/2 for gRPC and HTTP/1.1 for apps that don't support prenegotiated HTTP/2. For example, k8s health checks and Prometheus metrics scraping.

Describe the solution you'd like

A new environment variable for explicitly configuring HTTP/2 alongside by HTTP/1.1.

ASPNETCORE_HTTP_PORT=80
ASPNETCORE_HTTP2_PORT=81

ASPNETCORE_HTTP2_PORT port wouldn't use TLS. An alternative name is ASPNETCORE_H2C_PORT (HTTP/2 cleartext), but H2C isn't a commonly used term by devs.

We need to figure out how ASPNETCORE_HTTP2_PORT (and ASPNETCORE_HTTP_PORT) interacts with endpoint defaults.

If the endpoint default version is HTTP/1.1 then ASPNETCORE_HTTP2_PORT should stay HTTP/2. But what about TLS?

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions