latestOpenAPI 3.0.2cPanel License2026-08-106251554.3 MB

3da41671c02c

ModSecurity
Rule Settings

Validate ModSecurity rule

This function checks a ModSecurity™ rule's validity.

Important:

When you disable the Web Server role, the system disables this function.

get/modsec_check_rule

Query parameters

rulestring required
Example:SecAction "pass,id:1234567"

The ModSecurity rule to check.

Response

HTTP Request was successful.

Example response

{
  "data": {
    "problem": "The rule is invalid. Apache returned the following error: AH00526: Syntax error on line 1 of /var/tmp/15500._USR_LOCAL_CPANEL_WHOSTMGR_BIN_XML_API__.gl2t8wZ1.tmp/validate.conf:\nInvalid command ''OWASP'', perhaps misspelled or defined by a module not included in the server configuration\n'"
  },
  "metadata": {
    "command": "modsec_check_rule",
    "reason": "OK Invalid Rule",
    "result": 1,
    "version": 1
  }
}