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

Check method in ServeDir #249

Merged
merged 2 commits into from Apr 24, 2022
Merged

Check method in ServeDir #249

merged 2 commits into from Apr 24, 2022

Conversation

davidpdrsn
Copy link
Member

Motivation

Methods outside of GET and HEAD don't make much sense for serving static files but ServeDir (and therefore also ServeFile) would just accept all methods.

Solution

Check the method in ServeDir and respond with 405 Method Not Allowed if its not GET or HEAD. A response is immediately returned without calling the fallback.

@davidpdrsn davidpdrsn enabled auto-merge (squash) April 24, 2022 16:32
tower-http/CHANGELOG.md Outdated Show resolved Hide resolved
Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
@davidpdrsn davidpdrsn merged commit 4904b86 into master Apr 24, 2022
@davidpdrsn davidpdrsn deleted the serve-dir-method-not-allowed branch April 24, 2022 19:05
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

Successfully merging this pull request may close these issues.

None yet

2 participants