Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fallback handlers on nested routers returning 404 #2252

Open
maxburke opened this issue Oct 4, 2023 · 5 comments
Open

Fallback handlers on nested routers returning 404 #2252

maxburke opened this issue Oct 4, 2023 · 5 comments
Labels
A-axum C-bug Category: This is a bug.

Comments

@maxburke
Copy link

maxburke commented Oct 4, 2023

I'm trying to do an upgrade from axum-0.6.11 to axum-0.6.20 and I noticed that the behavior we were relying on in 0.6.11, where a nested handler could designate a fallback, seems to not work in 0.6.20.

I've got a test case in this repository:

https://github.com/maxburke/axum-test

With axum-0.6.11, curl -v http://localhost:3000/nest/ returns 200 + "Hello World", but with axum-0.6.20, the same curl command returns 404 + empty response.

@davidpdrsn davidpdrsn added this to the 0.7 milestone Oct 4, 2023
@davidpdrsn davidpdrsn added C-bug Category: This is a bug. A-axum labels Oct 4, 2023
@davidpdrsn davidpdrsn removed this from the 0.7 milestone Oct 4, 2023
@jplatte
Copy link
Member

jplatte commented Oct 4, 2023

Does that code even compile? (can't check, on mobile)
That example code passes a MethodRouter instead of a handler function to fallback.

@maxburke
Copy link
Author

maxburke commented Oct 4, 2023

Yup, it compiles. Changing the fallback to .fallback(root_handler) gives the same result.

@Protryon
Copy link

I have independently reproduced this.

@davidpdrsn
Copy link
Member

@Protryon do you wanna share your repro or is it secret? 😅

@Protryon
Copy link

Protryon commented Nov 14, 2023

@Protryon do you wanna share your repro or is it secret? 😅

It's not public, but the TL;DR was a nested router that had a route for / and /*var pointing to the same routes. GET /xyz and GET /xyz/t worked, but GET /xyz/ didn't. I reverted to 0.6.11, and it fixed itself. Fallbacks similarly didn't work for this use case, but worked in 0.6.11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-axum C-bug Category: This is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants