Module salvo_extra::force_https
source · Available on crate feature
force-https
only.Expand description
Middleware force redirect to https.
Force the current request to be redirected to the https protocol.
Example:
use salvo_core::prelude::*;
use salvo_extra::force_https::ForceHttps;
#[handler]
async fn hello() -> &'static str {
"hello"
}
#[tokio::main]
async fn main() {
let router = Router::with_hoop(ForceHttps::new().https_port(1234)).goal(hello);
let acceptor = TcpListener::new("0.0.0.0:5800").bind().await;
Server::new(acceptor).serve(router).await;
}
Structs§
- Middleware for force redirect to http uri.