Config Rust project HTTPS

I cannot config my Rust project under https. I dont know how I have to do it.
i want to change http://localhost for https://localhost

i tried enabling tls on Cargo.toml and nothing happends.

certs ="/path_to_private.pem"
key = "/pat_to.key"

Thx in advance

You did not mention which framework you use. I'm going to assume you're using Rocket, as that one has an option called "global.tls".

I think you have to enable the tls feature in your Cargo.toml like so

rocket = { version = “whatever_you_use”, features = [“tls”] }

(in the [dependencies] section)

Then, you have to create Rocket.toml (←different file) and put the

certs ="/path_to_private.pem"
key = “/pat_to.key”


1 Like

Thanks for the help.