latestOpenAPI 3.0.2cPanel License2026-08-106251554.3 MB

3da41671c02c

ModSecurity
Server Settings

Update ModSecurity configuration

This function sets a global ModSecurity™ configuration directive.

Important:

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

get/modsec_set_setting

Query parameters

setting_idinteger required
Example:8

The setting's ID.

Note:

The WHM API 1 modsec_get_settings function returns this value.

statestring required
Example:2000

The setting's new state. The function uses this as a valid argument for the directive.

Note:

For more information, read SpiderLabs' ModSecurity documentation.

Response

HTTP Request was successful.

Example response

{
  "data": {
    "default": "1500",
    "description": "This setting allows you to define the match limit of the PCRE library.",
    "directive": "SecPcreMatchLimit",
    "name": "PCRE library match limit",
    "radio_options": [
      {
        "name": "Log all transactions.",
        "option": "On"
      }
    ],
    "setting_id": 8,
    "state": 2000,
    "type": "text",
    "url": "https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#secpcrematchlimit",
    "validation": [
      {
        "arg": "[Ee]xample",
        "name": "startsWith"
      }
    ]
  },
  "metadata": {
    "command": "modsec_set_setting",
    "reason": "OK",
    "result": 1,
    "version": 1
  }
}