handler404 and handler500 get called if django tries to serve a page
that doesn't exist or a page that errors. Your 413 is generated from
apache, and so does not ever call django, therefore django cannot
handle this error.
To get around this, set
ErrorHandler 413 /some/django/url
Apache will use an internal redirect to fetch this URL, so it should
be transparent to your users.
Cheers
Tom
I think this is reasonable, just imagine that somebody would try to
upload for example /dev/urandom or /dev/zero (i. e. an infinite amount
of data). Would you want the server to suck it all in and then give an
error message saying that the limit has been exceeded?
Michal Petrucha
Think for a moment about how this works. You've set the upload limit
to 500k. If you start uploading more than this, then the web server
can really only do one thing, it can send you a 413 response and close
the connection.
If your browser then tries to continue to upload the file, it will try
to write data to a closed socket connection, and fail. If it's smart,
it will then see if there is a response to read from the socket,
otherwise it will display a cryptic 'connection interrupted' message.
Try the same test in a bunch of browsers; I bet Opera will handle it
correctly.
You've asked for the connection to be interrupted, by setting
LimitRequestBody. It can't both limit the request body size, and wait
for a client to be ready to read the error response.
Cheers
Tom