Skip to content

Index route returns 404 with NormalizePath middleware #318

@mrmykey

Description

@mrmykey

Bug Report

Versions:
tower-http = "0.3.5"
axum = "0.6.1"

Axum "/" route doesn't work (returns 404) with NormalizePath middleware

#[tokio::main]
async fn main() {
    let app = NormalizePath::trim_trailing_slash(
        Router::new()
            .route("/", get(|| async { "index" }))
            .route("/other", get(|| async { "other" }))
    );

    let addr = SocketAddr::from(([127, 0, 0, 1], 3000));
    axum::Server::bind(&addr).serve(app.into_make_service()).await.expect("Failed to start axum server");
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions