Skip to content

Commit 944a98d

Browse files
committed
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.
1 parent f9ac74e commit 944a98d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/middleware.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ pub fn build_middleware(app: Arc<App>, endpoints: R404) -> MiddlewareBuilder {
4747
if env == Env::Development {
4848
// Print a log for each request.
4949
m.add(Debug);
50-
// Locally serve crates and readmes
51-
m.around(StaticOrContinue::new("local_uploads"));
5250
}
5351

5452
if env::var_os("DEBUG_REQUESTS").is_some() {
@@ -103,6 +101,11 @@ pub fn build_middleware(app: Arc<App>, endpoints: R404) -> MiddlewareBuilder {
103101
m.around(StaticOrContinue::new("dist"));
104102
}
105103

104+
if env == Env::Development {
105+
// Locally serve crates and readmes
106+
m.around(StaticOrContinue::new("local_uploads"));
107+
}
108+
106109
m.around(Head::default());
107110

108111
for (header, blocked_values) in config.blocked_traffic {

0 commit comments

Comments
 (0)