Advanced rules
Info
This feature is available for the Enterprise package.
Similarly to WAAP custom rules, you can create, edit, and manage advanced custom rules. These rules also contain “If/Then” statements, but they support more complex conditions created with the Common Expression Language (CEL) syntax.
Create advanced rules
Due to the highly technical aspect of the advanced rules functionality, the ability to create and manage these rules is currently only available through our API.
Check out the following guides for details on how to create advanced rules and their key components:
-
API docs: Learn how to construct and manage advanced rules.
-
Advanced rule objects and attributes: Get the list of all available objects you can use in rule expressions along with their respective attributes and types.
-
Source field objects: Check the available source field objects you can use in your expressions along with their respective attributes and types.
Advanced rule properties
The advanced rule object contains the following properties:
Info
Each rule can contain only one action—block
, allow
, captcha
, handshake
, or tag
. If you use multiple actions in a single rule, the API will return an error.
Best practices
You can use our API documentation as a guide in constructing your own advanced rules. The following sections demonstrate a few examples of advanced rules created via our API using cURL.
Rate limiting
Block IPs that hit more than 200 requests per 5 seconds (changeable) when the following cookies don’t exist. You can find more examples in our Rate limiting guide.
The penalty rule
If a block
action triggers, WAAP will tag matching requests with the penalty
tag as long as the block
action is active.
To ensure the blocking of specific sources, you must also check for thepenalty
tag by defining a separate rule that blocks requests with the penalty
tag or by including the tag check as part of a rule’s source
condition.
Block all penalty requests
The following rule will block all requests with the penalty
tag. This ensures block
actions triggered by any rule will be enforced.
Creating a separate rule for the penalty
tag is useful when you have exhausted the 5 tags limit in a single rule.
Validate a set of countries
Use JavaScript validation to challenge IPs that are coming from countries without certain cookies:
Add clients to allow list
Tag and allow registered clients
Make sure that the tag value is enclosed in the double-quotes character ”.
Define login pages
Review existing rules
After you create advanced rules, they will appear on the WAAP rules page in the Gcore Customer Portal. You can enable or disable the rules by clicking the relevant toggles.