Skip to main content

Custom WAF Rules

Aegis supports fully custom WAF rules in two modes: Condition Builder for structured field/operator/value rules and Raw Regex for advanced RE2-based pattern matching.

Rule Options

Every custom rule supports the following configuration:
OptionDescription
NameRule display name
DescriptionDetailed description of what the rule detects
CategoryClassification category
Severitylow, medium, high, or critical
Actionblock, allow, challenge, log, or redirect
EnabledToggle rule on/off
ParanoiaParanoia level (1-4)
TagsFree-form tags for organization
OWASP IDsAssociated OWASP identifiers
CVE IDsAssociated CVE identifiers

Condition Builder Mode

Condition Builder is the standard rule-authoring flow. It supports multi-line field-based rules with AND / OR logic.

Available Fields

FieldDescription
Request URIFull request URI
Request PathURL path component
Query StringURL query string
HTTP MethodRequest method (GET, POST, etc.)
Request BodyRequest body content
User AgentUser-Agent header value
Host HeaderHost header value
Content-TypeContent-Type header value
RefererReferer header value
Source IPClient source IP address
Any HeaderMatch against any request header
Specific HeaderMatch against a named header
Any CookieMatch against any cookie
Specific CookieMatch against a named cookie

Available Operators

OperatorDescription
containsField contains the value
does not containField does not contain the value
equalsExact match
does not equalNot an exact match
starts withField starts with the value
ends withField ends with the value
matches regexRE2 regex match
does not match regexRE2 regex non-match
is in listValue is in a provided list
is not in listValue is not in a provided list
greater thanNumeric comparison
less thanNumeric comparison
existsField is present (no value needed)
does not existField is absent (no value needed)
is IP in rangeIP or CIDR range match

Per-Condition Options

  • Case Sensitive — toggle case sensitivity
  • Negate Result — invert the condition match

Examples

  • Block requests where Request Path contains /wp-admin
  • Block requests where Specific Header matches regex a malicious header pattern
  • Allow requests where Source IP is IP in range 10.0.0.0/8

Raw Regex Mode

Raw Regex mode is for advanced rules and built-in style pattern matching. You provide a Go RE2 pattern and one or more request targets to inspect.

Supported Targets

TargetDescription
Path / URIRequest path and URI
Query StringURL query parameters
BodyRequest body
HeadersAll request headers
CookiesAll cookies
User AgentUser-Agent header

Notes

  • Patterns are compiled with Go’s regexp engine (RE2 syntax)
  • Inline flags such as (?i) are supported (server-side evaluation)
  • Rules require both a pattern and at least one target

Rule Testing

The rule tester uses the real backend evaluation path. You can test:
  • Condition-based rules
  • Regex-based rules
  • Full request shapes including path, query, headers, cookies, body, and user-agent
Validation and test results are based on the same Go-side logic the live WAF uses, not a browser-only approximation.