.NET 6 adds HTTP/3 support to Kestrel. HTTP/3 uses **QUIC** (UDP-based), avoiding head-of-line blocking that plagues TCP-based HTTP/2.
Enabling HTTP/3
builder.WebHost.ConfigureKestrel(options =>
{
options.ListenAnyIP(5001, listenOptions =>
{
listenOptions.Protocols = HttpProtocols.Http1AndHttp2AndHttp3;
listenOptions.UseHttps();
});
});
Client Usage
var client = new HttpClient { DefaultRequestVersion = HttpVersion.Version30 };
var response = await client.GetAsync("https://localhost:5001");
Key Takeaways
- Browsers negotiate HTTP/3 automatically via Alt-Svc header.
- Ideal for high-latency networks (mobile).
- Requires TLS 1.3.
Discover more from C4: Container, Code, Cloud & Context
Subscribe to get the latest posts sent to your email.