set-vars

Stores values under vars.* for later rules’ expressions and interpolations.

Phaseson_tcp_connecton_http_requeston_http_response
Terminating No — the next action runs after it.
Cost Free

Example

policy.yaml
on_http_request:
  - actions:
      - type: set-vars
        config:
          vars:
            - tier: "${getReqHeader('x-tier')[0]}"
  - expressions: ["vars.tier == 'free'"]
    actions:
      - type: rate-limit
        config:
          name: free tier
          algorithm: sliding_window
          capacity: 100
          rate: 60s
          bucket_key: [conn.client_ip]

Start an agent endpoint with it: devgate http 8080 --traffic-policy-file policy.yaml, or paste it into a reserved or cloud endpoint’s Traffic Policy tab in the dashboard.

Configuration

Field Type Description
vars
required
list of maps Each entry is one name: value. String values may use ${…}.

Behaviour

  • Variables live for one request.

Other actions

add-headers remove-headers compress-response basic-auth oauth openid-connect jwt-validation custom-response deny redirect url-rewrite restrict-ips rate-limit circuit-breaker verify-webhook http-request log close-connection forward-internal