Skip to content

Instantly share code, notes, and snippets.

@brianmed
Created December 7, 2024 02:00
Show Gist options
  • Save brianmed/b454187aca774a93db625171d1a28e70 to your computer and use it in GitHub Desktop.
Save brianmed/b454187aca774a93db625171d1a28e70 to your computer and use it in GitHub Desktop.
Example way to configure Http3 in Kestrel
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