Monday, March 28, 2011

413 Request Entity Too Large


413 ( Request Entity Too Large) - returned when the server refuses to process the request because of too large a request body. The server may close the connection to stop further transmission of the request.

One of the most probable causes - including default settings nginx, but rather setting client_max_body_size, which defaults to 1m, making it impossible to download files larger than 1 megabyte.

The documentation describes nginx that client_max_body_size directive sets the maximum size of the body the client's request, indicated by the line "Content-Length" header in the request. If size is greater than a given, the client returns error "Request Entity Too Large" (413).

To solve the problem with downloading files, you need to nginx configuration file directive to increase the value client_max_body_size to the required size of you.

To do this in the file 
/etc/nginx/nginx.conf (for linux ) (or / usr/local/etc/nginx/nginx.conf for freebsd), a section of http, add (or change it if it's already there) parameter to "client_max_body_size 16m; " and then restart nginx using the "service nginx restart " (or "/etc/init.d/nginx restart" or "/usr/local/etc/rc.d/nginx restart").



nginx.conf:

....
http {
    .....
    .....
    client_max_body_size 16m;
    ....
}


No comments: