Fix serving `local_uploads` during development
To serve uploaded crates during local development, the middleware must
serve the request before the ember rewrite occurs.  Additionally, these
requests should not affect the tally in the `BalanceCapacity`
middleware.
@@ -47,8 +47,6 @@ pub fn build_middleware(app: Arc<App>, endpoints: R404) -> MiddlewareBuilder {
if env == Env::Development {
// Print a log for each request.
m.add(Debug);
- // Locally serve crates and readmes
- m.around(StaticOrContinue::new("local_uploads"));
}
if env::var_os("DEBUG_REQUESTS").is_some() {
@@ -103,6 +101,11 @@ pub fn build_middleware(app: Arc<App>, endpoints: R404) -> MiddlewareBuilder {
m.around(StaticOrContinue::new("dist"));
}
+ if env == Env::Development {
+ // Locally serve crates and readmes
+ m.around(StaticOrContinue::new("local_uploads"));
+ }
+
m.around(Head::default());
for (header, blocked_values) in config.blocked_traffic {
