Rocket and TLS/HTTPS

I'm learning how to use Rocket to create an API server.
I have a working example at rust-rocket-demo/main.rs at master · mvolkmann/rust-rocket-demo · GitHub.
My next step was to modify it to use HTTPS, but I found this at Configuration - Rocket Programming Guide": "Warning: Rocket's built-in TLS is not considered ready for production use. It is intended for development use only ."

I guess this means production uses of Rocket are typically placed behind some other server that provides HTTP like nginx, right?

Is there another popular Rust crate for implementing API servers that supports using HTTPS on its own?

I know you can do it on hyper.

1 Like
  • Hyper is a bit more low-level and would require configuring the TLS connection manually with a library like Rustls. It doesn't provide features like routing and such built-in, so can be difficult to use (although plain matches will get you far).
  • Warp, which is built on hyper, can automatically configure it for you and uses Rustls internally - but as a library is very differently designed to Rocket.
  • Actix-web is more similar to Rocket and also supports TLS, based on native-tls, OpenSSL or Rustls.
  • Tide also supports TLS but it doesn't support HTTP/2 so you might not want to use it.
2 Likes

Also Gotham (based on Hyper) has a good support of TLS