While restoring a large Odoo database backup on an existing server, a “413 Request Entity Too Large” error surfaced. The immediate assumption was an issue with nginx, leading to adjustments in the client_max_body_size directive. However, the error persisted — even when accessing Odoo directly via IP and port, bypassing both nginx and Apache. This pointed to a less conventional root cause. Despite appearances, this issue wasn’t related to the web server. In fact, modifying client_max_body_size had no impact. Initially, attention turned to the Odoo configuration file (/etc/odoo/odoo.conf), where one might expect a setting like:
However, this directive could not override the upload limit when set through the configuration file alone.
The breakthrough came by modifying a constant in the Odoo source code. Specifically, the following line in odoo/odoo/http.py (line 235):
After making this change, the database restoration succeeded without further errors.
While editing base files is generally discouraged — especially for maintainability and future updates — this workaround was necessary under the circumstances. Ideally, Odoo will provide a more flexible, config-level solution in future releases, eliminating the need for such manual changes. Until then, this method serves as a practical fix for large backup imports triggering the 413 error.