Skip to main content

strip_prefix

Function strip_prefix 

Source
pub fn strip_prefix(
    prefix: String,
    handler: impl Handler + 'static,
) -> impl Handler
Expand description

Strips prefix from the request path before forwarding to handler. Port of Go’s http.StripPrefix.

If the path does not start with prefix the request is answered with 404. The forwarded request has its URL path rewritten to the stripped path so the inner handler sees the correct path.