latestOpenAPI 3.0.2cPanel License2026-08-106251554.3 MB

3da41671c02c

ModSecurity
Rule Settings

Update staged ModSecurity rule

This function stages edits to a ModSecurity™ rule. The system does not save changes directly to the configuration file. Instead, it stages the changes to the configuration file's .STAGE file (for example, for the example.conf file, the system stages changes in the example.conf.STAGE file).

Important:

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

get/modsec_edit_rule

Query parameters

configstring required
Example:modsec_vendor_configs/example.conf

The ModSecurity configuration file, relative to the /usr/local/apache/conf/ directory.

idinteger required
Example:1234567

The ModSecurity rule's ID.

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

The new ModSecurity rule.

Response

HTTP Request was successful.

Example response

{
  "data": {
    "rule": {
      "id": 1234567,
      "rule": "SecAction \"pass,id:1234567\""
    }
  },
  "metadata": {
    "command": "modsec_edit_rule",
    "reason": "OK",
    "result": 1,
    "version": 1
  }
}