HTTP

HTTP 413 Content Too Large vs 415 Unsupported Media Type

Both HTTP 413 (Content Too Large) and 415 (Unsupported Media Type) belong to the 4xx Client Error category. 413 indicates that the request payload exceeds the server's size limit. Meanwhile, 415 means that the server refuses to accept the request because the Content-Type is not supported.

Description

The request payload exceeds the server's size limit.

When You See It

When uploading files that exceed the server's maximum upload size.

How to Fix

Reduce the payload size. Check server limits (Nginx: client_max_body_size, Apache: LimitRequestBody).

Description

The server refuses to accept the request because the Content-Type is not supported.

When You See It

When sending JSON to an endpoint that only accepts XML, or missing the Content-Type header.

How to Fix

Set the correct Content-Type header matching the data format you're sending.

Key Differences

1.

HTTP 413: The request payload exceeds the server's size limit.

2.

HTTP 415: The server refuses to accept the request because the Content-Type is not supported.

3.

You encounter 413 when when uploading files that exceed the server's maximum upload size.

4.

You encounter 415 when when sending JSON to an endpoint that only accepts XML, or missing the Content-Type header.

When to Use Which

For 413 (Content Too Large): Reduce the payload size. Check server limits (Nginx: client_max_body_size, Apache: LimitRequestBody). For 415 (Unsupported Media Type): Set the correct Content-Type header matching the data format you're sending.

Learn More