Question: Unable to attach files in a WebMail or any file upload when ModSecurity is active: An error occurred! File upload failed
Applicable to: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
CauseUpload file process fails because ModSecurity SecRequestBodyLimit is reached.
Resolution1.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 671088644.Press Apply