/domains/{name}/modsec
0.2.30Unchanged since publicationSet a domain's ModSecurity mode or its owner's choice
domainsallSupply mode, choice, or both. The domain's owner, the reseller who manages the owner, and administrators can set choice. Only administrators can set mode. The API returns 403 if another caller supplies mode and 400 if neither field is supplied or a mode value is invalid.
If the owner has a choice, the weaker of that choice and the administrator's mode for the domain takes effect. Otherwise, the administrator's mode applies.
UrbeStack saves the settings and, when modsec.managed is enabled, updates the domain's Apache virtual host and ModSecurity configuration as needed. UrbeStack tests the Apache configuration only if it changes and reloads Apache if the test passes. If Apache rejects the configuration, UrbeStack restores the previous configuration and discards the changes. The response contains the same details as GET /domains/{name}/modsec.
As a command
Run as root on the serverParameters
namepath ·DomainNameRequiredRequest body
JSON· 2 fieldschoicestring, one of off, logging, blocking or nullmodestring, one of off, logging, blocking or nullExample
See the API overview for how to set $API and $TOKEN.curl -sS -X PATCH "$API/domains/example.com/modsec" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"choice": "off",
"mode": "off"
}'200 OK{
"allowed": "off",
"choice": {
"at": "text",
"mode": "off"
},
"customized": true,
"disabled_rules": {
"by_owner": 1,
"max": 1,
"total": 1
},
"domain": "example.com",
"in_force": "off",
"locked": true,
"managed": true,
"own": {
"at": "text",
"by": "text",
"mode": "off"
},
"owner": "text",
"server": {
"by_hand": "off",
"mode": "off"
}
}Errors
11 errors, each a status and a sentence400A ModSecurity mode is off, logging or blocking400Domain name required400Domain name too long400Invalid domain name400Nothing to set: give a mode, a choice or both400Nothing to set: give mode, choice or both401Authentication required403A domain's own mode is set by an administrator404Domain '<name>' not found409ModSecurity is off for <name> by the administrator, so its owner's choice would change nothing409The administrator allows up to <NAMES>{<base>} for <name>; its owner may lower that, not raise iturbestack.com/docs/api/patch-domains-name-modsec/