Skip to content

Commit 7b7d315

Browse files
committed
copy V 8, moniker prep
1 parent a28d0ab commit 7b7d315

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed

aspnetcore/fundamentals/servers/kestrel/http3.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,6 @@ HTTP/3 and QUIC have a number of benefits compared to HTTP/1.1 and HTTP/2:
8383

8484
:::moniker-end
8585

86+
[!INCLUDE[](~/fundamentals/servers/kestrel/includes/http3-8.md)]
87+
8688
[!INCLUDE[](~/fundamentals/servers/kestrel/includes/http3-6-7.md)]
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
:::moniker range="= aspnetcore-8.0"
2+
3+
[HTTP/3](https://datatracker.ietf.org/doc/rfc9114/) is an approved standard and the third major version of HTTP. This article discusses the requirements for HTTP/3. HTTP/3 is fully supported in ASP.NET Core 7.0 and later.
4+
5+
> [!IMPORTANT]
6+
> Apps configured to take advantage of HTTP/3 should be designed to also support HTTP/1.1 and HTTP/2.
7+
8+
## HTTP/3 requirements
9+
10+
HTTP/3 has different requirements depending on the operating system. If the platform that Kestrel is running on doesn't have all the requirements for HTTP/3, then it's disabled, and Kestrel will fall back to other HTTP protocols.
11+
12+
### Windows
13+
14+
* Windows 11 Build 22000 or later OR Windows Server 2022.
15+
* TLS 1.3 or later connection.
16+
17+
### Linux
18+
19+
* `libmsquic` package installed.
20+
21+
`libmsquic` is published via Microsoft's official Linux package repository at `packages.microsoft.com`. To install this package:
22+
23+
1. Add the `packages.microsoft.com` repository. See [Linux Software Repository for Microsoft Products](/windows-server/administration/linux-package-repository-for-microsoft-software) for instructions.
24+
2. Install the `libmsquic` package using the distro's package manager. For example, `apt install libmsquic=1.9*` on Ubuntu.
25+
26+
**Note:** .NET 6 is only compatible with the 1.9.x versions of libmsquic. Libmsquic 2.x is not compatible due to breaking changes. Libmsquic receives updates to 1.9.x when needed to incorporate security fixes.
27+
28+
### macOS
29+
30+
HTTP/3 isn't currently supported on macOS and may be available in a future release.
31+
32+
## Getting started
33+
34+
HTTP/3 is not enabled by default. Add configuration to `Program.cs` to enable HTTP/3.
35+
36+
:::code language="csharp" source="samples/6.x/KestrelSample/Snippets/Program.cs" id="snippet_Http3" highlight="7-8":::
37+
38+
The preceding code configures port 5001 to:
39+
40+
* Use HTTP/3 alongside HTTP/1.1 and HTTP/2 by specifying `HttpProtocols.Http1AndHttp2AndHttp3`.
41+
* Enable HTTPS with `UseHttps`. HTTP/3 requires HTTPS.
42+
43+
Because not all routers, firewalls, and proxies properly support HTTP/3, HTTP/3 should be configured together with HTTP/1.1 and HTTP/2. This can be done by specifying [`HttpProtocols.Http1AndHttp2AndHttp3`](xref:Microsoft.AspNetCore.Server.Kestrel.Core.HttpProtocols.Http1AndHttp2AndHttp3) as an endpoint's supported protocols.
44+
45+
For more information, see <xref:fundamentals/servers/kestrel/endpoints>.
46+
47+
## Alt-svc
48+
49+
HTTP/3 is discovered as an upgrade from HTTP/1.1 or HTTP/2 via the [`alt-svc`](https://developer.mozilla.org/docs/Web/HTTP/Headers/Alt-Svc) header. That means the first request will normally use HTTP/1.1 or HTTP/2 before switching to HTTP/3. Kestrel automatically adds the `alt-svc` header if HTTP/3 is enabled.
50+
51+
## Localhost testing
52+
53+
* Browsers don't allow self-signed certificates on HTTP/3, such as the Kestrel development certificate.
54+
* `HttpClient` can be used for localhost/loopback testing in .NET 6 or later. Extra configuration is required when using `HttpClient` to make an HTTP/3 request:
55+
56+
* Set [`HttpRequestMessage.Version`](xref:System.Net.Http.HttpRequestMessage.Version) to 3.0, or
57+
* Set [`HttpRequestMessage.VersionPolicy`](xref:System.Net.Http.HttpRequestMessage.VersionPolicy) to [`HttpVersionPolicy.RequestVersionOrHigher`](xref:System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher).
58+
59+
## HTTP/3 benefits
60+
61+
HTTP/3 uses the same semantics as HTTP/1.1 and HTTP/2: the same request methods, status codes, and message fields apply to all versions. The differences are in the underlying transport. Both HTTP/1.1 and HTTP/2 use TCP as their transport. HTTP/3 uses a new transport technology developed alongside HTTP/3 called [QUIC](https://datatracker.ietf.org/doc/html/draft-ietf-quic-transport-34).
62+
63+
HTTP/3 and QUIC have a number of benefits compared to HTTP/1.1 and HTTP/2:
64+
65+
* Faster response time of the first request. QUIC and HTTP/3 negotiates the connection in fewer round-trips between the client and the server. The first request reaches the server faster.
66+
* Improved experience when there is connection packet loss. HTTP/2 multiplexes multiple requests via one TCP connection. Packet loss on the connection affects all requests. This problem is called "head-of-line blocking". Because QUIC provides native multiplexing, lost packets only impact the requests where data has been lost.
67+
* Supports transitioning between networks. This feature is useful for mobile devices where it is common to switch between WIFI and cellular networks as a mobile device changes location. Currently, HTTP/1.1 and HTTP/2 connections fail with an error when switching networks. An app or web browsers must retry any failed HTTP requests. HTTP/3 allows the app or web browser to seamlessly continue when a network changes. Kestrel doesn't support network transitions in .NET 8. It may be available in a future release.
68+
69+
:::moniker-end

0 commit comments

Comments
 (0)