Page Rules
In a YAML configuration file, you can define multiple page rules.
Parameter Explanation
Parameter Name | Data Type | Required | Description |
---|---|---|---|
enable_rule | bool | Yes | The enable state of the rule (enabled or disabled) |
conditions | array | No | The collection of preconditions for the rule to take effect |
actions | dict | No | Actions to be taken after the rule is triggered |
waf | dict | No | Web Application Firewall (WAF) configuration |
cache | dict | No | Cache related configuration |
last | bool | No | Whether to stop processing subsequent rules after the current rule matches |
For a detailed explanation and usage examples of more parameters, please refer to the following documentation:
Configuration Example
- enable_rule: true
conditions:
- var: uri
op: eq
vals:
- /hello
waf:
rule_sets:
- scanner_detection
- protocol_enforcement
- application_attack_xss
- application_attack_sqli
sensitivity: medium
action: "403 Forbidden"
cross_requests: false
actions:
set-proxy-uri:
uri: /hello/world
cache:
cache_key:
- name: req-header
args: customid
- name: 'query-string'
enforce_cache: true
default_ttls:
- ttl_unit: min
status: 200
ttl: 300
In this example, when the URI
is equal to /hello
, the rule will be triggered:
- Initiating the WAF rule set
- Setting the upstream server to
hello-backend
- Enforcing a caching strategy
The cache key is composed of the customid
in the request header and the query string. The default Time To Live (TTL) for caching is 300 minutes.