pub async fn redirect_to_www(
    req: ServiceRequest,
    next: Next<impl MessageBody + 'static>
) -> Result<ServiceResponse<impl MessageBody>, Error>
Expand description

A function middleware to redirect traffic to www. if not already there.

Examples

use actix_web_lab::middleware::{from_fn, redirect_to_www};

App::new()
    .wrap(from_fn(redirect_to_www))