Suggested
Settings for Various API Servers
Common server
list and recommended settings:
ASP.NET
(Classic)
<system.web>
<httpRuntime
maxRequestLength="10240" />
</system.web>
ASP.NET Core
(C#)
app.Use(async
(context, next) =>
{
context.Features.Get<IHttpMaxRequestBodySizeFeature>().MaxRequestBodySize
= 104857600;
await next.Invoke();
});
Express.js
(Node.js)
app.use(express.json({
limit: '10mb' }));
FastAPI
(Python)
Handled at ASGI
server level (e.g., Uvicorn) or middleware. No built-in limit in FastAPI
itself.
Flask
(Python)
app.config['MAX_CONTENT_LENGTH']
= 16 * 1024 * 1024
Django
(Python)
Use DATA_UPLOAD_MAX_MEMORY_SIZE in
settings or configure web server (Nginx, etc.).
Nginx
client_max_body_size
10M;
Koa.js
(Node.js)
app.use(bodyParser({
jsonLimit: '10mb' }));
Spring Boot
(Java)
spring.servlet.multipart.max-request-size=10MB
spring.servlet.multipart.max-file-size=10MB
Ruby on
Rails
Adjust Rack
limits or configure the web server (Nginx/Apache).
Go (Golang)
r.Body =
http.MaxBytesReader(w, r.Body, 10<<20)
Phoenix
Framework (Elixir)
plug
Plug.Parsers,
parsers: [:urlencoded, :multipart,
:json],
pass: ["*/*"],
json_decoder: Jason,
length: 10_000_000
Actix-web
(Rust)
.app_data(web::JsonConfig::default().limit(10240))