Odoo 17 Large Database Restore Error –  413 Request Entity Too Large

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:

[options]
web.max_file_upload_size = 512

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):

DEFAULT_MAX_CONTENT_LENGTH = 128 * 1024 * 1024 # 128 MiB

was updated to:

DEFAULT_MAX_CONTENT_LENGTH = 500 * 1024 * 1024 # 500 MiB

After making this change, the database restoration succeeded without further errors.

Conclusion

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.

For more insights and professional Odoo Community/Enterprise implementations, connect with us at hashcodeit.com or drop an email at info@hashcodeit.com.  Transform your Odoo journey with precision and expertise!

Leave a Comment