413/414 Request URL/Entity Too Large Error Nginx

what is 413/414 request URL/entity too large issue?

Vikram Singh Jadon
Published in
3 min readDec 17, 2018


how to resolve 413/414 nginx issue

Ever tried to upload a huge file or send a very large payload in the request?

If yes, you must have received status code 413 from nginx saying that the “request entity is too large for nginx to handle”.

The reason for this error response is because of the “client_max_body_size” parameter in the nginx configuration.

Web servers keep a limit on the maximum size of the request that can be sent to them. This is handled using client_max_body_size parameter. That is because, as mentioned in this stack exchange answer and I quote —

If you configure “client_body_max_size" to a large value, then you are putting your server in the same scenario as by 2013 when Django allowed users to use a very long password forcing Django (rather the server where it is hosted) to perform very expensive hash calculations leading, as you may guess, to a denial-of-service attack against the whole Django’s authentication framework.

In nginx documentation, By default the value of client_body_max_size is 1 MiB.

If it is a requirement to change client_body_max_size in nginx configuration, It can be done in the following way:

  • Run the the following command to editnginx.conf file.
vi /etc/nginx/nginx.conf
  • Add the following line at the top of http, server or location context to edit the size and then save and close the file.
client_max_body_size 10M;
  • Restart nginx using the following command.
sudo service nginx restart

There you go, the maximum permitted request size in nginx configuration has been changed.

HTTP 414 request-URI too large

I encountered this error while working on Open-Source project in elixirAvia Commerce.

The HTTP 414 URI Too Long response status code indicates that the URI requested by the client is longer than the server is willing to interpret.

Talking in terms of “Nginx” web server. This can also be handled in the similar manner as HTTP 413 error. To handle this we have to modify large_client_header_buffers parameter in the server configuration.

As mentioned in the documentation, default size of large_client_header_buffers is 8 KB.

This way you errors pertaining to max size of request payload or request URI can be handled.

AviaCommerce is an open source e-commerce framework written in Elixir, it leverages all the benefits of the battle-tested Erlang runtime mainly high availability and massive scalability. Do check out the Github repository, where all the action happens!


If you enjoyed this tutorial, please click the 👏 button and share to help others find it! Feel free to leave a comment below.



Vikram Singh Jadon

Freelance Software Engineer Working on Ruby, Elixir and Devops