Mod_security2 is an Apache2 module which blocks requests to the web server based on a list of server-side rules, also known as a Web Application Firewall (WAF). Rules include blocks against common server attacks, and they filter requests to vulnerable software. This additional security feature is activated by default on our servers in order to provide maximum protection from hacker attacks for the websites of our customers. However, it is possible for certain legitimate requests/scripts to match a rule and be blocked. When this happens, the error message returned by the server is 412 Request Blocked (Precondition failed). You are able to disable certain blocking rules, or completely disable mod_security2, by using an .htaccess file.
Disabling mod_security2 for XML-RPC files
The XML-RPC protocol is used by some WordPress modules to communicate with external resources, most notably - the Jetpack plugin and the official WordPress mobile apps. To read more on how to allow access to this file through the WordPress section of the Control Panel, click here.
If your site is using an xmlrpc.php file, but it is not WordPress-based, you can still disable mod_security2 for it with an .htaccess file – it should contain the following code:
The .htaccess file can be easily created using the File Manager page of the hosting Control Panel. The settings in this file apply to the directory in which it is located and recursively to its subdirectories.
Disabling a specific rule
By default, a number of abusive bots are blocked from visiting customer sites, with specific mod_security2 rules. These are the currently blocked bots, as well as their mod_security2 IDs:
"^Mozilla\/4\.0 \(compatible; MSIE 6\.0; Windows NT 5\.1;?( SV1)?;?\)$" id:373
"^Mozilla\/3\.0 \(compatible; Indy Library\)$" id:392
If you need to allow any of the above bots to access your site, you can disable the specific mod_security2 rule with an .htaccess file in the main folder of your website. Just use the SecRuleRemoveById directive as in the example above, and replace the ID with the ID of the specific rule.
Disabling mod_security2 altogether
|Completely disabling the mod_security2 module would decrease the security of your website considerably, so we strongly advise against doing that. Instead, please contact our Support team in order to find out which mod_security2 rule blocks the execution of your script. These rules can be disabled individually.|
If you are certain about disabling the mod_security2 module, you can create an .htaccess file in the directory where you want to disable it. The file should contain the following code: