Skip to content

Conversation

@Turbo87
Copy link
Member

@Turbo87 Turbo87 commented Dec 26, 2022

This corresponds roughly to

crates.io/src/router.rs

Lines 190 to 195 in bbcc099

// Allow blocking individual routes by their pattern through the `BLOCKED_ROUTES`
// environment variable. This is not in a middleware because we need access to
// `RoutePattern` before executing the response handler.
if req.app().config.blocked_routes.contains(pattern) {
return Ok(RouteBlocked.response().unwrap());
}

Note that with axum we can implement this as a middleware because axum middlewares run after the routing layer by default.

@Turbo87 Turbo87 added C-internal 🔧 Category: Nonessential work that would make the codebase more consistent or clear A-backend ⚙️ labels Dec 26, 2022
@Turbo87 Turbo87 merged commit 6d1f49a into rust-lang:master Dec 26, 2022
@Turbo87 Turbo87 deleted the axum-route-blocking branch December 26, 2022 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-backend ⚙️ C-internal 🔧 Category: Nonessential work that would make the codebase more consistent or clear

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant