Unable to attach files in a WebMail or any file upload when ModSecurity is

Started by Suhitha, Feb 23, 2026, 07:26 AM

Previous topic - Next topic

Suhitha

Question: Unable to attach files in a WebMail or any file upload when ModSecurity is active: An error occurred! File upload failed

Applicable to:

  • Plesk for Linux


Symptoms

  • Unable to attach files bigger than 15MB in webmail with following error:

An error occurred! File upload failed
  • Drag and drop file into webmail body message fails with following error:

Server error! (Request Entity Too Large)
  • Unable to attach big files to the website forms with the error below:

  • Connection to the server failed

  • Following error message is shown in Apache log file:

# tail -f /var/log/httpd/error_log
[:error] ModSecurity: Request body (Content-Length) is larger than the configured limit (13107200). [hostname "webmail.example.com"] [uri "/"] [unique_id "Wvm2-f069f312c27e"], referer: http://webmail.example.com/?_task=mail&_action=compose&_id=123456789abcdefgh

  • ModSecurity SecRequestBodyLimit parameter is set as follows:
# egrep -Ri SecRequestBodyLimit /etc/httpd/conf.d/mod_security.conf
SecRequestBodyLimit 13107200


Cause

Upload file process fails because ModSecurity SecRequestBodyLimit is reached.


Resolution

1.Log in to Plesk

2.Navigate to Tools & settings > Web Application Firewall (ModSecurity) > Settings:

3.Add the following line into the text field Custom directives:

SecRequestBodyLimit 67108864
4.Press Apply