From 7fd17ceba59c3bb5356d75cefdb6c86f462cfae6 Mon Sep 17 00:00:00 2001 From: Mohamed Macow <58916277+darth-raijin@users.noreply.github.com> Date: Fri, 21 Nov 2025 23:17:24 +0100 Subject: [PATCH] docs: Clarify `route_layer` does not apply middleware to the fallback handler (#3567) --- axum/src/docs/method_routing/route_layer.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/axum/src/docs/method_routing/route_layer.md b/axum/src/docs/method_routing/route_layer.md index 501b5517..b045d100 100644 --- a/axum/src/docs/method_routing/route_layer.md +++ b/axum/src/docs/method_routing/route_layer.md @@ -1,8 +1,7 @@ Apply a [`tower::Layer`] to the router that will only run if the request matches a route. -Note that the middleware is only applied to existing routes. So you have to -first add your routes (and / or fallback) and then call `route_layer` +Note that the middleware is only applied to existing routes. First add your routes and then call `route_layer` afterwards. Additional routes added after `route_layer` is called will not have the middleware added.