-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 in nested router isn't used when other routes on the root router match #3138
Comments
This seems like a matchit thing.. I think.
|
now that's interesting:
|
changing |
I think I tracked the issue down to this function and line 541 in particular. axum/axum/src/routing/path_router.rs Lines 534 to 545 in a192480
It seems like when nesting |
@liningpan you are probably looking for #2659 which is a different issue. You might want to look there for more details. |
Bug Report
Version
Platform
Darwin mondo-0984 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:12:58 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000 arm64
Description
When trying to migrate docs.rs to axum 0.8 I stumbled onto an issue with nested routing and fallbacks. In the breaking changes from the changelog I didn't see anything obvious that I did wrong, and the documentation still states the behaviour that I expect.
I have this example code:
Following the documentation about fallbacks and a nested router I would expect that a request to
/api/something
would lead toapi_fallback
being called.But what happens is that the route behind
/{name}/{version}
is called.In our case I have a nested router for static assets behind
/-/static
and want a custom static fallback if the first static routes don't match.with axum
~0.7
we usedget_service
here, which is not allowed any more, which is why I wanted to migrate tofallback_service
.The text was updated successfully, but these errors were encountered: