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

Option to prepend a path for redirects in ServeDir #487

Closed
1 task done
maxi0604 opened this issue May 1, 2024 · 1 comment
Closed
1 task done

Option to prepend a path for redirects in ServeDir #487

maxi0604 opened this issue May 1, 2024 · 1 comment

Comments

@maxi0604
Copy link

maxi0604 commented May 1, 2024

  • I have looked for existing issues (including closed) about this

Feature Request

Motivation

Currently ServeDir assumes that the files are served from /, which breaks trailing slash redirects in some configurations like a reverse proxy that redirects /somePath/* to the ServeDir server or a scenario where axum::Router::nest_service is used.

Proposal

Allow this to be configured, see #486

Alternatives

NormalizePathLayer doesn't work, since it removes the trailing slash and hence always triggers the TSR. Whether to perform the redirect depends on the files served (whether the requested path leads to a file or directory) so it seems reasonable to implement this in ServeDir.

A similar argument applies to axum_extras function route_with_tsr

@maxi0604
Copy link
Author

maxi0604 commented May 1, 2024

Ooops, the issue has already been reported here: #413

@maxi0604 maxi0604 closed this as not planned Won't fix, can't repro, duplicate, stale May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant