diff --git a/docs/POLICY.md b/docs/POLICY.md index a40ae9f..ede391a 100644 --- a/docs/POLICY.md +++ b/docs/POLICY.md @@ -42,7 +42,7 @@ request classification consumed by VCL-style cache rules. ## Stages and existing rules | Stage | Runs when | Relationship to VCL and existing headers | -|---|---|---| +| --- | --- | --- | | `pre_route` | After global and host access checks, before final location selection | Global and Vhost policies only. URL rewrites are restricted to this stage; the resulting target goes through normal routing and access validation. | | `request` | After route access/authentication, before source handling and cache request rules | Header changes are visible to existing `vcl_recv` and `vcl_hash` rules. | | `backend_request` | When sending a request to a selected reverse-proxy backend | After existing custom request headers; trusted identity and transport headers remain protected. Configuring this stage conservatively bypasses shared cache. | @@ -122,7 +122,7 @@ the JSON `values` array. `exists` takes no values. ACLs are named expressions in the same policy; unknown references and cycles are rejected. | Sample family | Examples | -|---|---| +| --- | --- | | Request identity | `method`, `path`, `url`, `query`, `host`; aliases `req.method`, `req.path`, `req.url`, `req.host` | | Request and response fields | `req.fhdr(Name)`, `res.fhdr(Name)` for complete field values; `req.hdr(Name)`, `res.hdr(Name)` for list members | | Counts and occurrences | `res.fhdr_cnt(Vary)` counts complete fields; `res.hdr_cnt(Vary)` counts list members; `res.fhdr(Vary,1)` selects the first field, `-1` the last | @@ -183,7 +183,7 @@ a client header does not make it a trusted authentication claim. ## Actions and cache boundaries | Area | JSON action types | -|---|---| +| --- | --- | | Headers | `set_header`, `append_header`, `remove_header`, `set_if_missing`, `replace_header`, `replace_value` | | Token lists | `normalize_header`, `merge_header`, `remove_value` | | Variables | `set_var`, `unset_var` | @@ -255,7 +255,7 @@ as `normalize-header` are extensions, not a promise of HAProxy compatibility. Use JSON for the full native model, including inline maps and explicit stages. | Imported form | Supported subset / difference | -|---|---| +| --- | --- | | `acl name fetch ...` | `-i`, `-m str/sub/beg/end/reg/int/bool/ip/found`, numeric comparisons and multiple patterns; repeated definitions of one ACL are ORed | | Conditions | `if`, `unless`, adjacent AND, `&&`, `or`/`\|\|`, `!`, inline `{ ... }`, and separated parenthesis tokens | | Header commands | `set-header`, `add-header`, `del-header`, `replace-header`, `replace-value`; HAProxy replacement references `\1` are converted to the native regex replacement form | @@ -289,25 +289,3 @@ entries, 128 regex patterns and 256 KiB of serialized policy. A rule has 1–16 actions; condition groups have at most 32 children and nesting is bounded at 16. Expression/regex expansion and transaction storage have additional limits. The complete configuration still has its existing 2 MiB bound. - -## Verification and upgrade - -Configurations without `policy` preserve the existing VCL and header behavior. -An older binary rejects the new key: remove policy objects before downgrading, -or restore a pre-upgrade configuration snapshot. No cache format change is -required by the policy model. Changing a global policy invalidates applicable -cached representations; changing a Vhost/location policy changes that scope's -cache identity. An invalid reload leaves the previous complete configuration -active. - -Run the Rust checks and regression tests from the source root: - -```bash -./dev.sh check -./dev.sh test -cargo clippy --locked --all-targets -- -D warnings -``` - -Passing a policy fixture or a mock-origin unit test alone does not establish -production readiness. Test the built binary with your authentication provider, -protocols, existing VCL and actual origin responses before deployment.