use actix_session::Session; use actix_web::http::header::LOCATION; use actix_web::{post, HttpResponse}; #[post("/logout")] async fn post(session: Session) -> HttpResponse { session.purge(); HttpResponse::SeeOther() .insert_header((LOCATION, "/")) .finish() }