Skip to content

Commit

Permalink
feat(servers): enlarge default body limit to 64M (#1873)
Browse files Browse the repository at this point in the history
  • Loading branch information
evenyag authored Jul 4, 2023
1 parent 451cc02 commit 2ef84f6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/servers/src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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"];
Expand Down Expand Up @@ -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::<BoxBody>::new(self.user_provider.clone()),
Expand Down

0 comments on commit 2ef84f6

Please sign in to comment.