Function warp::redirect::permanent

source ·
pub fn permanent(uri: impl AsLocation) -> impl Reply
Expand description

HTTP 308 Permanent Redirect Description: The requested resource has been permanently moved to a new URL, and future requests should use the new URL. Usage: Similar to 301, but like 307, it preserves the original request method when redirecting. It indicates that the redirection is permanent, and browsers and clients will cache this redirect like they do for 301.

This is similar to redirect but the HTTP method of the request to the new location will be the same as the method of the current request.

§Example

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

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