-
Notifications
You must be signed in to change notification settings - Fork 165
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
ServeDir
does not redirect correctly for directories without trailing /
when nested
#413
Comments
Nesting is a concept of axum, not tower / tower-http. This is tracked at tokio-rs/axum#1731. |
Unfortunately, this goes beyond axum. |
Yeah, I've thought a bunch about this in the meantime and I think it's probably much easier (and useful beyond axum) to add some prefix to |
I have created a PR: #486 |
Bug Report
Version
tower-http v0.4.4
Platform
All
Description
This function redirects paths that don't end with
/
and is a directory to the URI with/
appendedtower-http/tower-http/src/services/fs/serve_dir/open_file.rs
Line 253 in e8eb549
However it does not take into account where the service could be nested, therefore producing an invalid redirect.
Example directory:
main.rs:
Going to
localhost:3000/src/hello
to see the issueExpected: Redirects to
localhost:3000/src/hello/
and returns content atsrc/hello/index.html
Actual: Redirects to
localhost:3000/hello/
and returns Not FoundThe text was updated successfully, but these errors were encountered: