fix dx serve https=true error: 'no process-level CryptoProvider available -- call CryptoProvider::install_default() before this point' (#4736)

This commit is contained in:
Tom Grushka authored and GitHub committed 2025-10-07 13:10:09 -07:00
1 parent 9359446017
commit fc01a002fd
1 file changed
+5 -1
+5 -1
View File
@@ -26,6 +26,7 @@ use futures_util::{
StreamExt,
};
use hyper::HeaderMap;
use rustls::crypto::{aws_lc_rs::default_provider, CryptoProvider};
use serde::{Deserialize, Serialize};
use std::{
convert::Infallible,
@@ -412,7 +413,10 @@ async fn devserver_mainloop(
return Ok(());
}
// If we're using rustls, we need to get the cert/key paths and then set up rustls
// If we're using rustls, we need to install the provider, get the cert/key paths, and then set up rustls
if let Err(provider) = CryptoProvider::install_default(default_provider()) {
bail!("Failed to install default CryptoProvider: {provider:?}");
}
let (cert_path, key_path) = get_rustls(&https_cfg).await?;
let rustls = axum_server::tls_rustls::RustlsConfig::from_pem_file(cert_path, key_path).await?;