pub enum PathModifier {
ReplaceFullPath {
replace_full_path: String,
},
ReplacePrefixMatch {
replace_prefix_match: String,
},
}
Expand description
Defines configuration for path modifiers.
Variants§
ReplaceFullPath
Specifies the value with which to replace the full path of a request during a rewrite or redirect.
ReplacePrefixMatch
Specifies the value with which to replace the prefix match of a request during a rewrite or redirect. For example, a request to “/foo/bar” with a prefix match of “/foo” and a ReplacePrefixMatch of “/xyz” would be modified to “/xyz/bar”.
Note that this matches the behavior of the PathPrefix match type. This matches full path
elements. A path element refers to the list of labels in the path split by the /
separator. When specified, a trailing /
is ignored. For example, the paths /abc
,
/abc/
, and /abc/def
would all match the prefix /abc
, but the path /abcd
would not.
ReplacePrefixMatch is only compatible with a PathPrefix
route match::
Request Path | Prefix Match | Replace Prefix | Modified Path
-------------|--------------|----------------|----------
/foo/bar | /foo | /xyz | /xyz/bar
/foo/bar | /foo | /xyz/ | /xyz/bar
/foo/bar | /foo/ | /xyz | /xyz/bar
/foo/bar | /foo/ | /xyz/ | /xyz/bar
/foo | /foo | /xyz | /xyz
/foo/ | /foo | /xyz | /xyz/
/foo/bar | /foo | <empty string> | /bar
/foo/ | /foo | <empty string> | /
/foo | /foo | <empty string> | /
/foo/ | /foo | / | /
/foo | /foo | / | /
Trait Implementations§
Source§impl Clone for PathModifier
impl Clone for PathModifier
Source§fn clone(&self) -> PathModifier
fn clone(&self) -> PathModifier
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more