diff --git a/src/servers/src/http.rs b/src/servers/src/http.rs index 4e8da29192..9e3865a555 100644 --- a/src/servers/src/http.rs +++ b/src/servers/src/http.rs @@ -34,7 +34,7 @@ use aide::openapi::{Info, OpenApi, Server as OpenAPIServer}; use async_trait::async_trait; use axum::body::BoxBody; use axum::error_handling::HandleErrorLayer; -use axum::extract::MatchedPath; +use axum::extract::{DefaultBodyLimit, MatchedPath}; use axum::http::Request; use axum::middleware::{self, Next}; use axum::response::{Html, IntoResponse, Json}; @@ -104,6 +104,8 @@ pub(crate) async fn query_context_from_db( pub const HTTP_API_VERSION: &str = "v1"; pub const HTTP_API_PREFIX: &str = "/v1/"; +/// Default http body limit (64M). +const DEFAULT_BODY_LIMIT: usize = 64 * 1024 * 1024; // TODO(fys): This is a temporary workaround, it will be improved later pub static PUBLIC_APIS: [&str; 2] = ["/v1/influxdb/ping", "/v1/influxdb/health"]; @@ -544,6 +546,7 @@ impl HttpServer { .layer(HandleErrorLayer::new(handle_error)) .layer(TraceLayer::new_for_http()) .layer(TimeoutLayer::new(self.options.timeout)) + .layer(DefaultBodyLimit::max(DEFAULT_BODY_LIMIT)) // custom layer .layer(AsyncRequireAuthorizationLayer::new( HttpAuth::::new(self.user_provider.clone()),