Created
December 7, 2024 02:00
-
-
Save brianmed/b454187aca774a93db625171d1a28e70 to your computer and use it in GitHub Desktop.
Example way to configure Http3 in Kestrel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
builder | |
.WebHost | |
.ConfigureKestrel((context, options) => | |
{ | |
string keyPem = "-----BEGIN PRIVATE KEY-----...-----END PRIVATE KEY-----"; | |
string certPem = "-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----"; | |
options.ListenAnyIP(8080, listenOptions => | |
{ | |
X509Certificate2 x509 = X509Certificate2.CreateFromPem(certPem, keyPem); | |
listenOptions.UseHttps(x509); | |
listenOptions.Protocols = HttpProtocols.Http3; | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment