Open lovasoa opened 1 year ago
You may be correct about implementing ServerServiceFactory
, I'm not 100% sure yet. But I suspect that using a smart rustls config with HttpServer::listen_rustls
or HttpServer::bind_rustls
may do the trick as well. I'll look into this later today.
Oh, you mean we could just generate a single rustls ServerConfig, pass it to actix, and be done ? That would be awesome.
Yes, exactly. acme-rustls used to work like that, but then people started running into issues with alpn negotiation (iirc, if the client specifies alpn protocols and the server as well, there needs to be a match to proceed). But since actix already adds “h2” and “http/1.1” I don't think this applies here.
Could you something like this and report back:
let mut state = AcmeConfig::new(args.domains)
.contact(args.email.iter().map(|e| format!("mailto:{}", e)))
.cache_option(args.cache.clone().map(DirCache::new))
.directory_lets_encrypt(args.prod)
.state();
let rustls_config = state.challenge_rustls_config();
spawn(async move {
loop {
match state.next().await.unwrap() {
Ok(ok) => log::info!("event: {:?}", ok),
Err(err) => log::error!("error: {:?}", err),
}
}
});
HttpServer::new(|| App::new().route("/", web::get().to(HttpResponse::Ok)))
.bind_rustls_021(("127.0.0.1", 8080, ), rustls_config)?
.run()
.await
I'm happy to add a low_level_actix-web
example similar to low_level_tokio.rs
if that works.
It works, thank you ! It's a little bit magical to see it do everything automatically :)
rustls-acme
will be in SQLPage v0.17 !
https://github.com/lovasoa/SQLpage/pull/140
Hello ! I would like to use this crate with
actix-web
. Is this possible ? I don't see any may to pass rustls-acme's output to actixHTTPServer
Maybe this crate would need to implementServerServiceFactory
in order to useServerBuilder::listen
?