Appearance
Access, rate limits, bans and identity Since v0.2
These settings decide who may reach an application and how fast. Paths are relative to one entry of applications.
For the structure of the file, see Configuration file. Defaults of limits are also listed in Limits and defaults. A dash in Default means the code sets no default value (the setting is empty or off).
Access rules
| Key | Type | Default | Allowed values / range | Meaning | Guide page |
|---|---|---|---|---|---|
applications[].policy.access | object | — | — | Group of settings: access. | Access rules |
applications[].policy.access.mode | string | — | detect, block | empty: same as the application | Access rules |
applications[].policy.access.rules[] | list of object | — | — | Group of settings: rules. | Access rules |
applications[].policy.access.rules[].name | string | — | — | The name that identifies this entry. | Access rules |
applications[].policy.access.rules[].when | object | — | — | Group of settings: when. | Access rules |
applications[].policy.access.rules[].when.paths | list of string | — | — | Request paths the setting applies to. | Access rules |
applications[].policy.access.rules[].when.path_regex | string | — | — | Sets path regex. | Access rules |
applications[].policy.access.rules[].when.methods | list of string | — | — | HTTP methods the setting applies to. | Access rules |
applications[].policy.access.rules[].when.ip_lists | list of string | — | — | Sets ip lists. | Access rules |
applications[].policy.access.rules[].when.not_ip_lists | list of string | — | — | Sets not ip lists. | Access rules |
applications[].policy.access.rules[].when.cidrs | list of string | — | — | Address ranges in CIDR form. | Access rules |
applications[].policy.access.rules[].when.countries | list of string | — | — | Sets countries. | Access rules |
applications[].policy.access.rules[].when.not_countries | list of string | — | — | Sets not countries. | Access rules |
applications[].policy.access.rules[].expr | string | — | — | CEL; must hold together with when | Access rules |
applications[].policy.access.rules[].action | string | — | — | What happens on a match. | Access rules |
applications[].policy.access.rules[].skip | list of string | — | — | trust only: modules not run for matching requests | Access rules |
applications[].policy.access.rules[].ban_for | duration | — | — | ban only | Access rules |
applications[].policy.access.rules[].severity | string | — | — | Sets severity. | Access rules |
Rate limits
| Key | Type | Default | Allowed values / range | Meaning | Guide page |
|---|---|---|---|---|---|
applications[].policy.rate_limits | object | — | — | Group of settings: rate limits. | Rate limits |
applications[].policy.rate_limits.mode | string | — | detect, block | Whether the feature only logs (detect) or also acts (block). | Rate limits |
applications[].policy.rate_limits.rules[] | list of object | — | — | Group of settings: rules. | Rate limits |
applications[].policy.rate_limits.rules[].name | string | — | — | The name that identifies this entry. | Rate limits |
applications[].policy.rate_limits.rules[].when | object | — | — | Group of settings: when. | Rate limits |
applications[].policy.rate_limits.rules[].when.paths | list of string | — | — | exact path, or a prefix ending in "*" | Rate limits |
applications[].policy.rate_limits.rules[].when.methods | list of string | — | — | uppercase methods | Rate limits |
applications[].policy.rate_limits.rules[].when.ip_lists | list of string | — | — | Bot rules only (bot.*): the client's address in one of these lists, its TLS or HTTP fingerprint one of these values (or leading parts ending in *). | Rate limits |
applications[].policy.rate_limits.rules[].when.ja4 | list of string | — | — | Sets ja4. | Rate limits |
applications[].policy.rate_limits.rules[].when.ja4h | list of string | — | — | Sets ja4h. | Rate limits |
applications[].policy.rate_limits.rules[].limit | integer | — | — | Sets limit. | Rate limits |
applications[].policy.rate_limits.rules[].per | duration | — | — | Sets per. | Rate limits |
applications[].policy.rate_limits.rules[].action | string | — | — | block (default), log, ban | Rate limits |
applications[].policy.rate_limits.rules[].ban_for | duration | — | — | Sets ban for. | Rate limits |
applications[].policy.rate_limits.rules[].by | string | — | — | client (default), consumer, all | Rate limits |
applications[].policy.rate_limits.per_client_concurrency | integer | — | — | Sets per client concurrency. | Rate limits |
Bans
| Key | Type | Default | Allowed values / range | Meaning | Guide page |
|---|---|---|---|---|---|
applications[].policy.bans | object | — | — | Group of settings: bans. | Bans |
applications[].policy.bans.after_blocks | integer | — | — | Sets after blocks. | Bans |
applications[].policy.bans.within | duration | — | — | Sets within. | Bans |
applications[].policy.bans.for | duration | — | — | Sets for. | Bans |
Client identity
| Key | Type | Default | Allowed values / range | Meaning | Guide page |
|---|---|---|---|---|---|
applications[].policy.identity | object | — | — | identity says who a client is, for every module. | Client identity |
applications[].policy.identity.sources[] | list of object | — | — | sources are tried in order; the first one present in a request wins. | Client identity |
applications[].policy.identity.sources[].kind | string | — | — | Sets kind. | Client identity |
applications[].policy.identity.sources[].claim | string | — | — | jwt_claim | Client identity |
applications[].policy.identity.sources[].name | string | — | — | cookie, header | Client identity |
applications[].policy.identity.sources[].trusted_from | list of string | — | — | header: peers allowed to set it | Client identity |
applications[].policy.identity.ipv6_prefix | integer | — | — | Sets ipv6 prefix. | Client identity |
applications[].policy.identity.mode | string | — | detect, block | empty: same as the application (detect wins) | Client identity |
applications[].policy.identity.require | object | — | — | Group of settings: require. | Client identity |
applications[].policy.identity.require.paths | list of string | — | — | Request paths the setting applies to. | Client identity |
applications[].policy.identity.require.action | string | — | — | log | refuse | Client identity |
Example
yaml
version: 2
listeners:
- {name: web, address: "0.0.0.0:8080", protocol: http}
server_pools:
- name: shop
servers:
- {address: "127.0.0.1:9000", weight: 1, state: active}
ip_lists:
- name: office
cidrs: [10.0.0.0/8]
applications:
- name: shop
hostnames: [shop.example.com]
listeners: [web]
server_pool: shop
policy:
access:
rules:
- name: office-admin
when: {paths: ["/admin*"], ip_lists: [office]}
action: allow
- name: admin-elsewhere
when: {paths: ["/admin*"]}
action: block
rate_limits:
rules:
- name: login
when: {paths: [/login], methods: [POST]}
limit: 10
per: 1m
action: block