DB / HTTP/Web Servers / 413
WARNING

HTTP/Web Servers Payload Too Large (Request Entity Too Large)

The HTTP 413 status code indicates the server refused to process a request because the request payload (body) exceeds the server's configured size limit.

Common Causes

  • Uploading files larger than the web server's configured limit (e.g., Nginx's `client_max_body_size`, Apache's `LimitRequestBody`).
  • Application-level frameworks (like Express.js with `body-parser`) or reverse proxies having their own lower payload size limits.
  • Making API POST/PUT requests with large JSON or XML payloads that exceed the defined constraints.

How to Fix

1 Increase Nginx client_max_body_size

Set or increase the maximum allowed size of the client request body in Nginx configuration.

BASH
$ # In nginx.conf, http, server, or location block client_max_body_size 100M;

2 Increase Apache LimitRequestBody

Configure the maximum size in bytes of an HTTP request body in Apache.

BASH
$ # In httpd.conf, virtual host, or .htaccess LimitRequestBody 104857600 # 100MB in bytes

3 Check and Increase Application/Proxy Limits

For applications behind a proxy (like Node.js/Express) or the proxy itself (e.g., Traefik), ensure their limits are also increased.

BASH
$ # Example for Express.js with body-parser app.use(express.json({ limit: '100mb' })); app.use(express.urlencoded({ limit: '100mb', extended: true }));

4 Verify and Adjust Reverse Proxy Settings

If using a cloud load balancer (AWS ALB, GCP LB) or a reverse proxy like Traefik, check their request size limits.

BASH
$ # Example for Traefik IngressRoute (Kubernetes) apiVersion: traefik.containo.us/v1alpha1 kind: Middleware metadata: name: large-payload spec: buffering: maxRequestBodyBytes: 104857600