Skip to content

Fix serve_dir method not allowed handling when no fallback is configured#587

Merged
jlizen merged 1 commit into
tower-rs:mainfrom
soerenmeier:serve_dir_method_not_allowed_fallback
May 6, 2026
Merged

Fix serve_dir method not allowed handling when no fallback is configured#587
jlizen merged 1 commit into
tower-rs:mainfrom
soerenmeier:serve_dir_method_not_allowed_fallback

Conversation

@soerenmeier

Copy link
Copy Markdown
Contributor

Fixes a bug in ServeDir where non-GET/HEAD requests were incorrectly processed when call_fallback_on_method_not_allowed is enabled but no fallback service is provided.

Problem
When configured with call_fallback_on_method_not_allowed(true) but no fallback service, non-GET/HEAD requests would proceed through normal file serving logic instead of returning 405 Method Not Allowed.

Fixes a bug in `ServeDir` where non-GET/HEAD requests were incorrectly
processed when `call_fallback_on_method_not_allowed` is enabled but no
fallback service is provided.

@jlizen jlizen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Appreciate it!

@jlizen jlizen merged commit f0b3bb6 into tower-rs:main May 6, 2026
11 checks passed
@soerenmeier soerenmeier deleted the serve_dir_method_not_allowed_fallback branch May 6, 2026 23:38
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.

2 participants