# VCL capability matrix: implemented, limited and unsupported **Applies to the RustProxy 0.39.0 source tree with the Docker/Cache/Traffic and CDN-template fixes.** This is an implementation inventory, not a statement of general Varnish compatibility. The authoritative implementation is `src/cache/vcl.rs` (tokenization and import), `src/cache/rules.rs` (validation and rule evaluation), and `src/cache/policy.rs` / `src/cache/lookup.rs` (shared-cache admission and lookup). See [VCL syntax and header semantics](VCL.md) for implementation details, the [VCL traffic cookbook](VCL_TRAFFIC_COOKBOOK.md) for ready-to-import VCL and a request/response scenario matrix, and [HTTP cache](CACHE.md) for cache policy. ## Practical examples and traffic scenarios The companion [VCL traffic cookbook](VCL_TRAFFIC_COOKBOOK.md) contains **11 complete VCL examples** (including an intentionally restricted importer example and a high-risk advanced example), an HTTP request/response behavior matrix, `curl` checks, expected `PASS`/`MISS`/`HIT` behavior and troubleshooting. The standalone source files are in [`examples/vcl/`](../examples/vcl/). They cover public catalogs, JSON APIs, private routes, CDN cookies, public static files, multilingual responses, A/B variants, SSE/webhooks/errors, safe header changes, query normalization and highly restricted Set-Cookie removal. Each example states its origin/privacy contract and importer limitations. | Goal | Available through imported VCL | Native GUI/API required or not supported | |---|---|---| | Bypass admin/session/credentialed requests | `vcl_recv` with `return(pass)` | Authentication and access policy remain native | | Cache public GET JSON/catalog | `return(hash)` plus conditional `beresp.ttl` | Global/Vhost cache must already be enabled; only 200 can be stored | | Strip CDN technical cookies | Entire Cookie header removal after an exact allowlist | Removing one cookie by name from a mixed header: graphical action only | | Safely ignore `Vary: Cookie` on public static | VCL can remove request Cookie, but **not** safely override `Vary` | Narrow native static-asset settings, not a general Ignore Vary feature | | Multilingual/CORS/encoded responses | Preserve origin `Vary`; optional internal `vcl_hash` dimension | Origin must emit the complete downstream `Vary` dimensions | | Webhooks, SSE, transient errors | PASS, `beresp.uncacheable=true` | Retries, stale-if-error, streaming and backend failures are native behaviors | | Query tracking normalization | Recognized `regsuball` pattern, **with warning** | Prefer graphical Strip query params; arbitrary regex rewriting unsupported | | Negative cache, full VMOD, `vcl_hit`/`vcl_purge` | **No** | Not implemented as VCL in this release | ## Read this before deploying VCL 1. RustProxy **does not run a VCL interpreter**. `POST /api/cache/rules/import-vcl` parses a limited source document and returns **graphical rules plus warnings**. A rule runs only after it is accepted and the configuration is saved. 2. A syntactically accepted VCL instruction can have **different runtime behavior** from Varnish. In particular, `return(hash)` does not disable RustProxy's authorization and privacy safeguards, and `return(hit_for_pass)` does not create a hit-for-pass object. 3. **Warnings are significant.** The editor will not add a partial import automatically; choose **Add partial import (reviewed)** only if you have checked every skipped instruction and the resulting graph. An import that fails with a parser error creates no rule set. 4. VCL support is **limited to reverse-proxy HTTP Vhosts**. It does not provide Varnish behavior for the built-in static Web Server, PHP or the administration API. The same rule editor is available for manually configured and Docker-generated reverse-proxy Vhosts. 5. Cache rules do not enable caching by themselves. Both global and effective per-Vhost cache policy must permit it. Request rewrites can still be relevant on a cache-disabled reverse-proxy route. ## Status terminology | Status | Exact interpretation | |---|---| | **Supported** | Converted into a validated RustProxy cache rule; the documented effect is implemented. | | **Restricted** | Converted only for the listed syntax, stage or constant form; alternatives warn and are skipped. | | **Graphical only** | RustProxy has an equivalent or related rule editor action, but VCL source does **not** import it exactly. | | **Unsupported (intentional boundary)** | Not part of the importer/runtime by design of a graph-based, safety-constrained proxy, or intentionally not implemented as Varnish semantics. Do not assume it will be added. | | **Not implemented** | No corresponding VCL conversion/runtime functionality exists in this version; roadmap and future support are unspecified. | ## 1. Hooks and program structure | Varnish construct | Status | What RustProxy actually does | |---|---|---| | `sub vcl_recv { ... }` | Supported subset | Request-stage rules, in statement order; may bypass cache, request lookup, strip cookies or perform safe rewrites. | | `sub vcl_hash { ... }` | Restricted | Becomes a separate request hash stage. Runs after `vcl_recv` with a hash/lookup decision, but not after `return(pass)`. | | `sub vcl_backend_response { ... }` | Supported subset | Response-stage changes run against the origin response before shared-cache admission. | | `sub vcl_fetch { ... }` | Supported alias | Maps to response-stage behavior, not a historical Varnish backend state machine. | | `sub vcl_deliver { ... }` | Supported subset | Changes outgoing response headers. Does not alter stored variants/TTL. | | Other hooks: `vcl_init`, `vcl_fini`, `vcl_hit`, `vcl_miss`, `vcl_pass`, `vcl_pipe`, `vcl_synth`, `vcl_backend_fetch`, `vcl_backend_error`, `vcl_purge` | Not implemented | Unrecognized subroutine names generate an import warning; their body is not executed. | | `sub my_helper { ... }` and `call my_helper;` | Unsupported (intentional boundary) | No custom executable subroutines, VCL callbacks or extension language. | | Top-level `vcl`, `import`, `include` directives | Restricted | Lexer accepts them and skips to the terminating semicolon. **It does not load a module or another file.** | | Top-level `backend`, `acl`, `probe` definitions | Restricted | Blocks are skipped with warnings. Use RustProxy backend, health-check and ACL configuration. | | Arbitrary top-level statements | Not implemented | The importer reports an error instead of executing unknown declarations. | | `#`, `//`, `/* ... */` comments | Supported | Comments discarded; unclosed block comment is a parsing error. | | Short `"..."` and VCL long `{ " ... " }` string forms | Restricted | String tokenization is supported. Only specific instructions accept a string value; long strings do not make arbitrary VCL code executable. | ## 2. Branches, variables and comparisons | Syntax or variable | Status | Rules and caveats | |---|---|---| | `if (...) { ... }`, `elsif (...)`, `else`, nested `if` | Supported | Branch guards and previous-branch exclusions are converted; not a runtime scripting language. | | `&&`, `||`, `!`, parentheses | Supported with limits | Conditions expand to sets of graphical rule guards. Very complex expressions may exceed rule limits and are skipped with warnings. | | `req.url`, `bereq.url` | Supported for comparisons | Match path **and query** together. These aliases do not permit arbitrary URL rewrite. | | `req.method`, `req.request`, `bereq.method` | Supported | Comparisons to constant values. | | `req.http.
`, `bereq.http.
` | Supported | Header existence, equality and regex comparison; `req.http.Host` is mapped to normalized host scope. | | `beresp.status`, `resp.status`, `obj.status` | Supported in response/deliver | Numeric code comparisons: `==`, `!=`, `<`, `<=`, `>`, `>=`. They compile to one status or a bounded range. | | `beresp.http.
`, `resp.http.
`, `obj.http.
` | Supported in response/deliver | Response-header existence, equality and regex matching. Content-Type has a dedicated canonicalized condition. | | `==`, `!=`, `~`, `!~` | Supported | For appropriate recognized request/response fields; regex is Rust regex matching rather than arbitrary Varnish/PCRE execution. | | `client.ip ~ my_acl` | Not implemented for VCL | The importer warns. The **graphical** editor can match client IP/CIDR (see below). | | `std.*`, `server.*`, `req.backend_hint`, `req.url.path`, `req.url.qs`, `bereq.retries`, `beresp.backend.*`, `obj.hits`, `now`, TLS-specific VCL vars and VMOD variables | Not implemented | Unsupported variable/condition warning; they are not silently assigned live values. | | Arithmetic, regex capture substitution in conditions, concatenation, functions, assignments within `if`, lists/dictionaries/objects | Not implemented | Only supported simple atomic comparisons and boolean operations are converted. | | Bare `req.http.Cookie`, `req.http.Authorization` | Supported | Tests header presence. A nonempty header name variable is not a test of cookie *content*. | ### Header-field nuance `req.http.Cookie ~ "^(?:__cf_bm|...)=[^;]*$"` is safe as an **entire-header** technical-cookie allowlist only if every physical `Cookie` header field is examined. The rule matcher in this patched source joins multiple Cookie fields with `; ` for header-condition evaluation, so a second field containing `session=...` defeats the anchored allowlist. An invalid UTF-8 Cookie value is treated as *present*, preventing the subsequent `if (req.http.Cookie) { return(pass); }` from accidentally treating it as absent. Do **not** use an unanchored regex such as `req.http.Cookie ~ "__cf_bm"` with `unset req.http.Cookie;`: that would discard a session cookie merely because a technical cookie was also present. ## 3. Request-stage statements (`vcl_recv`) | Exact statement form | Status | Rule effect and restrictions | |---|---|---| | `return(pass);` | Supported | Cache bypass; terminates applicable request-stage rules and skips `vcl_hash`. | | `return(hash);`, `return(lookup);` | Supported with safety conditions | Explicit lookup; in Varnish-compatibility mode can admit **Cookie-bearing GET/HEAD** requests, partitioned by their remaining Cookie value and with downstream `Vary: Cookie`. Does not override Authorization, unsafe methods, client privacy or disabled cache. | | `unset req.http.Cookie;` | Supported | Removes **every** Cookie value before subsequent rules, origin forwarding and cache key generation. No per-name deletion in imported VCL. | | `set req.http.X-Name = "literal";` | Supported with protected-name list | Changes a safe request header to a constant string. Origin sees the change. Dynamic/compound expressions are not recognized. | | `unset req.http.X-Name;` | Supported with protected-name list | Removes all values of an allowed request header. | | `set req.url = regsuball(req.url, "...", "\\1");` | Restricted | Only a pattern that matches a captured query separator plus a known parameter-name list is converted to `strip_query`; importer warns about separator/empty-value differences. See [VCL details](VCL.md#request-header-changes-scope-and-safeguards). | | `set req.http.Cookie = regsuball(...)`, single-cookie deletion, `regsub()` on cookies | Not implemented | Use graphical **Strip cookies / Keep these cookies** instead. An imported VCL expression will **not** safely delete one cookie from a list. | | `set req.backend_hint`, `set req.method`, `set req.hash`, `set req.http.Authorization` | Unsupported (intentional boundary) | Request origin selection, security identity, method, HTTP framing and credentials remain controlled by RustProxy's normal Vhost/route/auth machinery. | | `return(pipe)`, `return(purge)`, `return(synth(...))`, `return(restart)` | Not implemented | Warnings, not equivalents to `pass` or other rules. | | `return(deliver)` in `vcl_recv` | Not implemented | This is not a supported return target in the request stage. | **Protected general request-header edits** include `Authorization`, `Cookie` (except dedicated whole-header removal), `Cache-Control`, `Pragma`, `Host`, `Range`, `If-*`, `Forwarded`, `Via`, `X-Forwarded-*`, `X-Real-IP`, `X-Client-IP`, `True-Client-IP`, `CF-Connecting-IP`, `Proxy-*`, `Sec-*`, `X-RustProxy-*`, `Content-Type`, `Expect` and the framing/proxy headers in section 6. Such edits are rejected on rule validation, including in imported VCL; valid neighboring actions are still imported. ## 4. Hash-stage statements (`vcl_hash`) | Exact statement | Status | Effect | |---|---|---| | `hash_data(req.url);` | Supported no-op | URL including query already participates in RustProxy's base key. | | `hash_data(req.http.Host);` | Supported no-op | Normalized request authority and vhost isolation already participate in the cache key. | | `hash_data(req.http.X-Device);` | Supported | Adds a request-header value to the internal variant key; `Vary: X-Device` is **not** automatically emitted. | | `hash_data(regsub(req.http.Cookie, ...))` | Not implemented | The graphical editor has a separate **Hash cookie** action; it is not a faithful VCL expression importer. | | `hash_data(client.ip)`, arithmetic/concatenation, VMOD expressions or multiple arguments | Not implemented | Generates warning. | | `hash_data(...)` inside `vcl_recv` | Not implemented | Warns: this instruction is only accepted in `vcl_hash`. | ## 5. Backend-response stage (`vcl_backend_response`, `vcl_fetch`) | Statement | Status | Cache/storage effect | |---|---|---| | `set beresp.ttl = 30s;` | Supported | Freshness override in seconds, bounded by configured limits; recognized units `ms`, `s`, `m`, `h`, `d`, `w`, `y`, plus bare seconds. Rounded to full seconds. Does **not** rewrite `Cache-Control` for browsers. | | `set beresp.grace = 5m;` | Supported | Grace override, within RustProxy limits; not Varnish's complete grace/keep lifecycle. | | `set beresp.uncacheable = true;` | Supported | Prohibits shared storage for the matching response. | | `set beresp.uncacheable = false;` | Supported, RustProxy-specific | Reverses **an earlier cache-rule-induced** no-store action. Does not nullify origin `private`, `no-store`, `Set-Cookie` or another admission barrier. | | `set beresp.http.X-Name = "literal";` | Supported with protected-name list | Overwrites the origin header **before** storage planning and before delivery. May affect admission if the header is `Cache-Control` or `Vary`. | | `unset beresp.http.X-Name;` | Supported with protected-name list | Removes a header before storage; deleting `Cache-Control: private/no-store` intentionally discards origin policy and can expose sensitive content. | | `unset beresp.http.Set-Cookie;` | Supported, dedicated dangerous exception | Removes upstream `Set-Cookie` before storage policy. Do not use for session-dependent responses. | | `return(pass);`, `return(hit_for_pass);`, `return(uncacheable);` | Restricted conversion | Prevents storage; **no Varnish hit-for-pass object** is created. | | `return(deliver);` | Supported | Stops later rules in the backend-response hook. | | `beresp.keep`, `beresp.do_stream`, `beresp.do_gzip`, `beresp.storage`, `beresp.backend`, `beresp.status`, `beresp.reason`, `beresp.http.Set-Cookie = ...` | Not implemented as VCL assignments | No equivalent imported instruction. HTTP storage/encoding and upstream selection have separate RustProxy controls. | | `return(retry)`, `return(abandon)`, `return(error)`, `return(synth)` | Not implemented | Unsupported return warning. | The shared cache stores **HTTP status 200** responses only in this release. A positive TTL for `404`, `301`, `302` or `500` does **not** enable negative/redirect/error-response caching. Requests with `Authorization`, no-store signals, disallowed methods, access restrictions or invalid response headers are not made cacheable simply by a VCL lookup decision. ## 6. Deliver-stage statements and header protection | Statement | Status | Effect | |---|---|---| | `set resp.http.X-Name = "literal";` | Supported with protected-name list | Replaces outgoing header on HIT, MISS or BYPASS. Does not alter the stored metadata or variant. | | `unset resp.http.X-Name;` | Supported with protected-name list | Removes outgoing header only. | | `return(deliver);` | Supported | Stops the remaining deliver-stage rule chain. | | `set resp.status`, `set resp.reason`, dynamic `resp.http.* = req.http.*`, `regsub` on resp headers | Not implemented | No response-body/status rewriting or dynamic expressions through imported VCL. | | `return(synth)`, `return(restart)` | Not implemented | Not equivalent to sending a synthetic response or reprocessing the request. | **Headers protected from general backend and deliver edits:** `Connection`, `Content-Length`, `Content-Encoding`, `Content-Range`, `Date`, `Keep-Alive`, `Proxy-Authenticate`, `Proxy-Authorization`, `Set-Cookie`, `TE`, `Trailer`, `Transfer-Encoding`, `Upgrade`, `Host`, `Alt-Svc`. The **only** exception is the dedicated `unset beresp.http.Set-Cookie` action. Other subsystems can regenerate or normalize headers after rules have run. Header names compare case-insensitively; `set` replaces the entire repeated field and `unset` removes all occurrences. `set ... = ""` is not the same as `unset`. ### `Vary` is supported but phase-sensitive | Operation | Internal cache variants | Delivered response | Recommendation | |---|---|---|---| | Origin `Vary: Accept-Encoding, Accept-Language` | Both dimensions retained | Passed downstream | Safe default. | | `set beresp.http.Vary = "Accept-Language";` | **Replaces** all origin dimensions before variant planning | Sends new field unless overridden later | Only if origin truly varies solely by language. | | `unset beresp.http.Vary;` | Removes variation requirements **before** admission | Usually removed downstream | Unsafe for personalized/encoded variants. | | `set resp.http.Vary = "Accept-Language";` | **No change** to stored variants | Overrides outgoing field only | Avoid mismatch with the actual storage key. | | `unset resp.http.Vary;` | **No change** to stored variants | Removes outgoing field | Can cause downstream CDN/browser variant leakage. | | Global `static_ignore_vary_cookie` on a public static extension | May remove **Cookie only**, after public/fresh/no-Set-Cookie/privacy checks | Qualifying response no longer varies by Cookie | Do not extend to arbitrary Vary dimensions. | `Vary: *` is not reusable. All other retained dimensions must match, including the distinction between absent and present-but-empty headers. RustProxy safely normalizes selected list headers (`Accept-Language`, `Accept-Encoding`, `Accept-Charset`, `Accept`), preserving required semantics; it does not treat opaque `User-Agent`, `Origin`, `Cookie` or custom headers as interchangeable. See [RFC 9111 matching](CACHE.md#vary-matching-rfc-9111-41). **Do not add a global “Ignore Vary” switch.** It risks wrong content under different encodings, languages, CORS origins, user-agent-specific responses or authenticated contexts. The existing narrowly scoped `Ignore Vary: Cookie for public static assets` option should remain restricted; fix unnecessary `Vary` at the origin when possible. ## 7. Graphical actions without a faithful imported VCL equivalent These capabilities exist in RustProxy's JSON/graphical cache rules but should **not** be inferred to work by pasting arbitrary VCL syntax: | Graphical rule/setting | VCL import limitation | |---|---| | Client IP/CIDR condition | `client.ip ~ acl` not imported. | | Path, extension and query-param conditions | Graphical matching is supported; some exported VCL examples are approximations, not guaranteed round-trip. | | Match a cookie by name/value | `req.http.Cookie` regex supports header testing, but the graphical dedicated cookie condition is not a generic VCL parser feature. | | **Strip cookies, keep** selected names | VCL importer accepts only `unset req.http.Cookie` for whole-header removal. | | **Strip query params** or **keep only** listed params | Only a specific tracking-parameter `regsuball(req.url,...)` form is imported, always with a warning. | | **Hash cookie** by name | Graphical-only; `hash_data(regsub(...))` is not imported. | | **Default header** (set if absent) | Available graphically; VCL `if (!resp.http.X) set ...` may import through basic header-existence guards, but exact graphical ownership/precedence is not guaranteed as a round trip. | | **Ignore backend Cache-Control** | Graphical storage-policy override; not the same as a plain VCL `unset beresp.http.Cache-Control`. | | Scoped global rules, per-Vhost rules, ignore global rules | Stored in RustProxy config, not in VCL source text; imported VCL uses the editor's scope. | | Global/per-vhost static Cookie/`Vary` options | Configuration switches, not VCL statements. | ## 8. Intentionally excluded and otherwise missing Varnish functionality | Feature | Classification | Rationale / alternative | |---|---|---| | Full VCL execution engine and arbitrary VMODs/C modules | **Intentional architectural boundary** | Only validated JSON cache rules execute. Configure supported proxy features through their native Settings/Vhost editor. | | Mutating authentication, identity, transport framing and protected request headers through cache VCL | **Intentional safety boundary** | Prevents bypassing access control, spoofing, cache-policy restrictions or invalid HTTP framing. | | Rewriting raw `Cookie` by broad regex or partially deleting cookies through imported VCL | **Intentional narrow importer** | No unsafe best-effort translation; use full-header `unset` only after an anchored allowlist, or use the graphical cookie-allowlist action for a reviewed policy. | | Varnish hit-for-pass / hit-for-miss objects and `beresp.keep` | **Intentionally not imported** | RustProxy has its own miss collapsing, revalidation and temporary uncacheable-fill handling; these are not Varnish object types. | | Custom backend/ACL/probe definitions in imported VCL | **Intentional configuration boundary** | Configure those as RustProxy backends/ACL profiles/health checks. The source blocks are explicitly warned/skipped. | | Unsafe or unsupported `return(pipe/restart/purge/synth)` | **Not implemented by VCL importer** | HTTP tunneling, administrative purge, synthetic responses and routing use separate native mechanisms, where available. | | Storing 3xx, 4xx and 5xx as shared cache objects | **Not implemented** | Status 200 only; no negative-cache guarantee. | | Varnish ESI, VCL body manipulation, edge includes, custom streaming hooks | **Not implemented** | No VCL capability to parse/modify response bodies. Use separate native transforms only where explicitly supported. | | Varnish backend retries, directors, storage stevedores, clustering/sharding via VCL | **Not implemented as VCL** | RustProxy has independent load balancing/upstream pools and HOT/COLD storage. | | Dynamic expressions, direct filesystem calls, networking from VCL, custom system functions | **Not implemented by design of the rule model** | No executable user-defined code or side effects at the VCL layer. | | Exact VCL export/import round-trip | **Not supported** | Export is an explanatory preview. Back up canonical JSON/configuration instead. | The labels above distinguish explicit product limits from missing work; **not implemented** does *not* assert that a future release will implement a feature. ## 9. Limits, validation and test plan | Limit/condition | Implemented boundary | |---|---| | VCL source length | **256 KiB** maximum. | | Rules | **128** compiled rules per applicable rule list. | | Rule conditions/actions | Up to **16** conditions and **16** actions per rule. Long supported action sequences are split as needed; branch expansion can hit limits earlier. | | Rule values | Up to **64** values per condition, **512 bytes** each. | | Regex program budget | Up to **512 bytes per condition value**; compiled regex builder has **1 MiB** NFA/DFA budgets (`64 KiB × 16`). Invalid/overcomplex expressions are rejected. | | TTL/grace | Whole-second setting subject to maximum **365 days** and effective cache settings. | | Origin status | **200** required for shared storage. Other responses can still receive appropriate header edits. | | Import warnings | Need explicit review and acceptance in the UI; never treat warnings as a successful, equivalent conversion. | ### Regression checklist for a deployment 1. Import the candidate VCL and require **no unexpected warnings**. Inspect the generated rules in the appropriate global/Vhost/Docker scope. 2. Test GET/HEAD with no Cookie, only technical CDN cookies, mixed technical + `session`, multiple physical Cookie lines, and `Authorization`. 3. Test protected paths, POST/PUT, invalid Vary, `Vary: *`, `Set-Cookie`, `Cache-Control: private/no-store/no-cache` and responses other than 200. 4. Verify both **cached** and **delivered** `Vary` behavior for `Accept-Encoding`, `Accept-Language`, `Origin` and any origin-defined custom dimension. 5. On a real, authorized test origin send two identical requests to compare MISS/HIT and a changed Vary dimension to ensure distinct variants. The rule tester **cannot replace** this test. 6. For Docker services, repeat after a container disappears and returns, checking the same saved Vhost assignment and the Cache/Traffic scope labels. ### Included opt-in CDN cookie policy The source file [`examples/vcl/cdn-technical-cookies.vcl`](../examples/vcl/cdn-technical-cookies.vcl) and the **CDN technical cookies** cache-rule template provide the same basic safe policy: bypass unsafe methods, sensitive paths and Authorization; strip Cookie only when **all cookies** are in a known allowlist; otherwise bypass. The list includes Cloudflare (`__cf_bm`, `cf_clearance`, `_cfuvid`, `__cfruid`, `__cfseq`) and Akamai (`_abck`, `ak_bmsc`, `bm_sz`, `bm_sv`). Review the list for your origin and CDN challenge flow: some technical/security cookies are needed by the origin and **must not** be stripped in those deployments. This policy is **opt-in**; it does not change the default behavior of existing Vhosts. The source contains a Rust regression test (`src/cache/rules_tests.rs`) exercising import and per-request evaluation, plus a Node frontend template contract test (`tests/js/cdn-cookie-template.cjs`). A JavaScript-only test is **not** evidence that the Rust executable compiled or that a real proxy backend was tested.