Skip to content

Commit d0e956c

Browse files
authored
fix(http/route): fix prefix path validation (#4175)
Fixes linkerd/linkerd2#14110 When using a `HTTPRoute` `RequestRedirect` filter with a `ReplacePrefixMatch`, the proxy incorrectly returns an error: `redirect paths must be absolute`. This is because the validation logic is backwards and it returns this error when the redirect path IS absolute. We correct the validation logic by inverting it. Signed-off-by: Alex Leong <[email protected]>
1 parent 0060a4c commit d0e956c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

linkerd/http/route/src/http/filter/redirect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ pub mod proto {
259259
Ok(ModifyPath::ReplaceFullPath(path))
260260
}
261261
api::path_modifier::Replace::Prefix(prefix) => {
262-
if prefix.starts_with('/') {
262+
if !prefix.starts_with('/') {
263263
return Err(InvalidRequestRedirect::RelativePath);
264264
}
265265
Ok(ModifyPath::ReplacePrefixMatch(prefix))

0 commit comments

Comments
 (0)