Page Rules

In a YAML configuration file, you can define multiple page rules.

Parameter Explanation

Parameter NameData TypeRequiredDescription
enable_ruleboolYesThe enable state of the rule (enabled or disabled)
conditionsarrayNoThe collection of preconditions for the rule to take effect
actionsdictNoActions to be taken after the rule is triggered
wafdictNoWeb Application Firewall (WAF) configuration
cachedictNoCache related configuration
lastboolNoWhether 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.