sslrusttls1.2rust-axum

Axum + TLS | How to specify config?


Before axum I've worked with rust rocket framework. Rocket provides special file Rocket.toml where configuration can be specified. In there I wrote key and certs paths, but how to do the same in axum?

I have checked axum's examples and tried to use axum-server, but it looks like dead? I got an error with dependecies and don't know how to fix that. Even i don't know is there any sense to create an issue in axum-server repo.

If someone knows the different way - it would be great!
Error:

Copying platform assembly files from C:/Users/*/.cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.24.0/aws-lc/generated-src/win-x86_64/crypto/ to D:/Rust/test-repo/target/debug/build/aws-lc-sys-5c959976a3609b0f/out/build/aws-lc/crypto
  mingw32-make[2]: *** No rule to make target 'aws-lc/crypto/CMakeFiles/crypto_objects.dir/chacha/chacha-x86_64.asm.obj', needed by 'artifacts/libaws_lc_0_24_0_crypto.a'.  Stop.
  mingw32-make[1]: *** [CMakeFiles\Makefile2:272: aws-lc/crypto/CMakeFiles/crypto.dir/all] Error 2
  mingw32-make: *** [Makefile:135: all] Error 2
  thread 'main' panicked at C:\Users\*\.cargo\registry\src\index.crates.io-6f17d22bba15001f\cmake-0.1.52\src/lib.rs:1115:5:

Solution

  • This is caused by a dependency tree (axum-server, rustls, aws-lc-sys) that is not well maintained. aws-lc is the cause of the cmake error.

    To fix this, use something that doesn't depend on aws-lc:

    [dependencies]
    axum-server = { version = "0.7.1", features = ["tls-rustls-no-provider"] }
    rustls = { version = "0.23.23", default-features = false, features = ["std", "log", "logging", "ring"] }