Why do I see a “413 request entity too large” error?

If you see a “413 request entity too large” error on your site, it indicates that your web browser is sending an HTTP “POST” command that is very large (bigger than at least 5 MB), even though the POST is marked as containing only plain data and not files.

This conflicts with the mod_security software that we (and most other hosting companies) use, because that software examines non-file data to look for security problems, but it has a limit on how much it will accept.

This is an unusual and technical problem, related to the “Content-Type” of the HTTP POST request you’re making. Normally, a script that sends large amounts of data such as files will send it as “Content-Type” multipart/form-data instead of application/x-www-form-urlencoded, which would avoid this.

If you are the author of the script that generates the POST request, and it’s submitting a file (or generating data similar in size to a file), you should change it to use multipart/form-data. That will avoid this problem and possibly others, making your script work much more like the way other scripts on the Web work.

This page on the w3.org site explains more technical details about “multipart/form-data”.