pub fn redirect(uri: impl AsLocation) -> impl Reply
Expand description

A simple 301 permanent redirect to a different location.

Example

use warp::{http::Uri, Filter};

let route = warp::path("v1")
    .map(|| {
        warp::redirect(Uri::from_static("/v2"))
    });