From cc9cedc268a650d9083e62412de1d43967cf487b Mon Sep 17 00:00:00 2001 From: Rakesh Emmadi <12475069+rakeshkky@users.noreply.github.com> Date: Tue, 2 Apr 2024 16:20:28 +0530 Subject: [PATCH] Set request payload limit to 10 MB (#429) V3_GIT_ORIGIN_REV_ID: b0377caff0cb6c65b51179037e09e6eae9dc3bfb --- v3/crates/engine/bin/engine/main.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/v3/crates/engine/bin/engine/main.rs b/v3/crates/engine/bin/engine/main.rs index 1bc086da52b..990a136d5ba 100644 --- a/v3/crates/engine/bin/engine/main.rs +++ b/v3/crates/engine/bin/engine/main.rs @@ -5,7 +5,7 @@ use std::sync::Arc; use axum::{ body::HttpBody, - extract::State, + extract::{DefaultBodyLimit, State}, http::{HeaderMap, Request}, middleware::Next, response::{Html, IntoResponse}, @@ -168,12 +168,15 @@ async fn start_engine(server: &ServerOptions) -> Result<(), StartupError> { let health_route = Router::new().route("/health", get(handle_health)); + const MB: usize = 1_048_576; + let app = Router::new() // serve graphiql at root .route("/", get(graphiql)) .merge(graphql_route) .merge(explain_route) - .merge(health_route); + .merge(health_route) + .layer(DefaultBodyLimit::max(10 * MB)); // Set request payload limit to 10 MB // The "unspecified" IPv6 address will match any IPv4 or IPv6 address. let host = net::IpAddr::V6(net::Ipv6Addr::UNSPECIFIED);