From e7c173162fe274f251ffd6b379ad58a4528667ae Mon Sep 17 00:00:00 2001 From: Sebastiano Tocci Date: Wed, 2 Aug 2023 00:10:46 +0200 Subject: [PATCH] added compression layer for the pkg route (#1928) --- server/core/src/https/mod.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/core/src/https/mod.rs b/server/core/src/https/mod.rs index dc921ea87..86a1e561d 100644 --- a/server/core/src/https/mod.rs +++ b/server/core/src/https/mod.rs @@ -207,7 +207,6 @@ pub async fn create_https_server( } ServerRole::WriteReplicaNoUI => Router::new(), }; - let app = Router::new() .route("/robots.txt", get(robots_txt)) .route("/status", get(status)) @@ -226,7 +225,10 @@ pub async fn create_https_server( ); std::process::exit(1); } - app.nest_service("/pkg", ServeDir::new(pkg_path)) + let pkg_router = Router::new() + .nest_service("/pkg", ServeDir::new(pkg_path).precompressed_br()) + .layer(middleware::compression::new()); + app.merge(pkg_router) } };