Skip to content

Commit

Permalink
allow requests to proxy to not have a trailing slash
Browse files Browse the repository at this point in the history
  • Loading branch information
rolyatmax committed May 31, 2024
1 parent 82ab7a9 commit 8a0f9b6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion plane/src/proxy/rewriter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,14 @@ fn extract_bearer_token(parts: &mut uri::Parts) -> Option<BearerToken> {
panic!("No path and query");
};

let (token, path) = path_and_query.path().strip_prefix('/')?.split_once('/')?;
let full_path = path_and_query.path().strip_prefix('/')?;

// Split the incoming path into the token and the path to proxy to. If there is no slash, the token is
// the full incoming path, and the path to proxy to is just `/`.
let (token, path) = match full_path.split_once('/') {
Some((token, path)) => (token, path),
None => (full_path, "/"),
};

let token = BearerToken::from(token.to_string());

Expand Down

0 comments on commit 8a0f9b6

Please sign in to comment.