Applicable to:
- Plesk Onyx for Linux
Symptoms
-
Unable to upload a file to the website hosted in Plesk with the error:
CONFIG_TEXT: 413 Request entity too large
CONFIG_TEXT: Request Entity Too Large
The requested resource
/upload-a-file/
does not allow request data with POST requests, or the amount of data provided in the request exceeds the capacity limit. -
ModSecurity component is installed on the server.
-
The following error can be found in
/var/www/vhosts/example.com/logs/error_log
file:CONFIG_TEXT: [:error] [pid 21701] [client 203.0.112.2] ModSecurity: Request body no files data length is larger than the configured limit (1048576).. Deny with code (413) [hostname "www.example.com"] [uri "/wp-admin/admin-ajax.php"] [unique_id "Wakfj-fvNMmcLKLp-n8PjQAAAAE"]
Cause
WAF_SECREQUESTBODYNOFILESLIMIT
parameter value reached its limit.
Resolution
-
Log into the server via SSH.
-
Open
/etc/asl/config
file using the vi text editor. -
Increase the value for the
WAF_SECREQUESTBODYNOFILESLIMIT
directive, for example to the value as below:CONFIG_TEXT: WAF_SECREQUESTBODYNOFILESLIMIT "10000000"
Note: it is specified in Bytes.
-
Execute the command below to update the rulesets:
# for i in daily weekly monthly; do /usr/local/psa/bin/sw-engine-pleskrun /usr/local/psa/admin/plib/DailyMaintainance/script.php -f UpdateModSecurityRuleSet --period "${i}"; done
This way the change will remain persistent after any updates/rulesets changes.
Comments
7 comments
Hi,
In CentOS 7 with Obsidian, the changes are working when modifying the file
/etc/httpd/conf/modsecurity.d/rules/tortix/modsec/tortix_waf.conf
The file /etc/httpd/conf.d/mod_security.conf is no existan.
Regards
Hello Alejandro Betancor
I've checked this on my test server and agree with you.
I will pass this to the article author.
how can that be done on ubuntu?
Hello Shai, article updated and new instructions can be done on Ubuntu too.
/asl/config I don't have asl file then how will I proceed ?
Hello @sanjiv,
It is not /asl/config file, but /etc/asl/config. If this file is missing, try this solution:
Log in to the server via SSH.
Set the following in the
/etc/httpd/conf.d/modsec2.imunify.conf
file with a vi text editor:SecResponseBodyLimit 546870912
SecRequestBodyNoFilesLimit 10485760
Note: it is specified in Bytes.
Restart Apache:
# systemctl restart httpd
If it does not help, check /var/www/vhosts/example.com/logs/error_log for detailed error that appears when issue is reproduced and search at support.plesk.com/hc using this error for another article.
There is no file with this name "modsec2.imunify.conf". Still I have an error 413 entity too large. Please suggest a working solution. I had already worked with each possible case to resolve the same.
Please sign in to leave a comment.