mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-18 05:50:41 +00:00
feat(servers): enlarge default body limit to 64M (#1873)
This commit is contained in:
@@ -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::<BoxBody>::new(self.user_provider.clone()),
|
||||
|
||||
Reference in New Issue
Block a user