perf: remove dead redirect middleware (ran on every request doing nothing)
The redirect middleware was a leftover from the custom HTTP server → Axum migration. It executed on every single request (including static files), allocating a String from the URI path and performing 3 starts_with() checks, but never actually redirected anything — just debug logging. - Remove middleware application from main.rs - Remove pub mod redirect from middleware/mod.rs - Delete redirect.rs (121 lines of dead code) Saves ~80-170ns of overhead per request (String alloc + comparisons + Tower layer dispatch).
This commit is contained in:
@@ -269,10 +269,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
}
|
||||
}
|
||||
|
||||
// Apply the redirect middleware for legacy routes
|
||||
use oxicloud::interfaces::middleware::redirect::redirect_middleware;
|
||||
app = app.layer(axum::middleware::from_fn(redirect_middleware));
|
||||
|
||||
// Increase the default body limit to 10 GB to allow large file uploads.
|
||||
// Without this Axum caps Multipart bodies at 2 MB.
|
||||
app = app.layer(DefaultBodyLimit::max(10 * 1024 * 1024 * 1024));
|
||||
|
||||
Reference in New Issue
Block a user