Skip to content

Automatic trailing slash redirect is broken when nesting with / #714

@tasn

Description

@tasn

Bug Report

Version

├── axum v0.4.4
│   ├── axum-core v0.1.1

Platform

Linux p15s 5.16.1-arch1-1 #1 SMP PREEMPT Sun, 16 Jan 2022 11:39:23 +0000 x86_64 GNU/Linux

Description

When using a nested router and in the nest just using / the slash redirect (308) works incorrectly.
Code:

pub fn app_router() -> Router {
    Router::new()
        .route("/", get(list_applications))
}

Router::new()
    .nest("/app", app_router())

Expected:

curl -v localhost:8080/app/

This command should return the correct data.

Instead: it returns a 308 redirect to localhost:8080/app (no trailing slash).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions