Skip to content

Commit 4cb8ddb

Browse files
madeyeclaude
andcommitted
Enable TLS 1.2 support and add ALPN protocols
Accept both TLS 1.2 and 1.3 connections for broader client compatibility. Advertise h2 and http/1.1 ALPN protocols. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f35e889 commit 4cb8ddb

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/tls.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use std::sync::Arc;
99

1010
use futures::StreamExt;
11+
use tokio_rustls::rustls::version::{TLS12, TLS13};
1112
use tokio_rustls::rustls::ServerConfig;
1213
use tokio_rustls_acme::caches::DirCache;
1314
use tokio_rustls_acme::{AcmeAcceptor, AcmeConfig};
@@ -38,11 +39,11 @@ pub fn build_acme_acceptor(config: &Config) -> anyhow::Result<AcmeSetup> {
3839
let acceptor = state.acceptor();
3940
let resolver = state.resolver();
4041

41-
let rustls_config = Arc::new(
42-
ServerConfig::builder()
43-
.with_no_client_auth()
44-
.with_cert_resolver(resolver),
45-
);
42+
let mut rustls_config = ServerConfig::builder_with_protocol_versions(&[&TLS13, &TLS12])
43+
.with_no_client_auth()
44+
.with_cert_resolver(resolver);
45+
rustls_config.alpn_protocols = vec![b"h2".to_vec(), b"http/1.1".to_vec()];
46+
let rustls_config = Arc::new(rustls_config);
4647

4748
// Spawn the ACME event loop to drive cert issuance/renewal.
4849
tokio::spawn(async move {

0 commit comments

Comments
 (0)