activitypub-federation-rust
activitypub-federation-rust copied to clipboard
Signing broken when using axum nested routers
little bit more information:
If you run an axum server with following code:
use axum::{body::Body, http::Request, routing, Router};
async fn get(req: Request<Body>) {
println!("{}", req.uri());
}
#[tokio::main]
async fn main() {
let api = Router::new().route("/health", routing::get(get));
let router = Router::new().nest("/api", api);
axum::Server::bind(&"0.0.0.0:3030".parse().unwrap())
.serve(router.into_make_service())
.await
.unwrap();
}
and request to localhost:3030/api/health?foo=bar, output is like:
/health?foo=bar
When we use nested router, axum's req.uri only shows matched path of the nested router.
We can use MatchedPath to retrieve full path, but we have to somehow concatenate the query string.