This commit is contained in:
Mateusz Gruszczyński committed 2026-11-20 21:56:12 +01:00
1 parent 08d1608ef5
commit d455028de3
16 files changed
+191 -48

No files matched your search

+5 -5
View File
@@ -4,13 +4,13 @@
## 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.
The companion [VCL traffic cookbook](VCL_TRAFFIC_COOKBOOK.md) contains **12 VCL recipes and an additional Drupal 6 parent-domain example** (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 |
| Strip CDN technical cookies | Entire Cookie header removal after an exact allowlist | Selective exact-name or trailing-* prefix removal is also available through the RustProxy `remove_req_cookies()` VCL extension |
| 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 |
@@ -82,11 +82,11 @@ Do **not** use an unanchored regex such as `req.http.Cookie ~ "__cf_bm"` with `u
| `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, risky | Removes **every** Cookie value; never use for a session-bearing Vhost. |
| `remove_req_cookies("exact_name", "another_name");` | Supported, RustProxy extension | Deletes **only** selected exact Cookie names on the request, retaining other cookies for later pass/cache checks; refused on malformed Cookie fields. Not stock Varnish VCL. |
| `remove_req_cookies("exact_name", "SESS*");` | Supported, RustProxy extension | Deletes selected exact Cookie names or case-sensitive name prefixes with one trailing `*`; keeps all other cookies for later pass/cache checks. Refuses malformed Cookie fields and rejects `*` alone, prefixes shorter than 3 characters, middle wildcards and general regexes. Not stock Varnish 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(...)`, `regsub()` on cookies | Not implemented | Arbitrary Cookie regex rewrites are unsafe and not imported; use `remove_req_cookies()` or graphical **Remove only named cookies** for selective removal. |
| `set req.http.Cookie = regsuball(...)`, `regsub()` on cookies | Not implemented | Arbitrary Cookie regex rewrites are unsafe and not imported; use `remove_req_cookies()` or graphical **Remove selected cookies (name / prefix*)** for selective removal. |
| `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. |
@@ -208,7 +208,7 @@ The labels above distinguish explicit product limits from missing work; **not im
### Included opt-in parent-domain cookie rule (separate from CDN)
The **Vhost: remove selected parent-domain cookies** graphical rule is available only in local Vhost/Docker Vhost editors, inserted disabled. It uses the **Remove only named cookies** action and an operator-edited exact list, not `Strip cookies` / whole-header removal. It applies to GET/HEAD without Authorization and outside example private paths, does **not** return(hash) and does **not** stop later request rules. The equivalent RustProxy-specific VCL `remove_req_cookies("cookie_name");` is imported as `remove_named_cookies`. When a request has parent and session cookies, the session remains; later CDN's `bypass remaining cookies` or RustProxy's default request-cookie guard prevents shared-cache reuse. The operator must verify that the listed name is never used by this Vhost; `Cookie` does not carry the originating Domain. The old whole-header public-Vhost template is no longer offered; remove any already-saved unsafe copy manually.
The **Vhost: remove selected parent-domain cookies** graphical rule is available only in local Vhost/Docker Vhost editors, inserted disabled. It uses the **Remove selected cookies** action and an operator-edited list of exact names or trailing-`*` prefixes, not `Strip cookies` / whole-header removal. It applies to GET/HEAD without Authorization and outside example private paths, does **not** return(hash) and does **not** stop later request rules. The equivalent RustProxy-specific VCL `remove_req_cookies("cookie_name", "SESS*");` is imported as `remove_named_cookies`. A wildcard matches by prefix only, and should be used exclusively for verified unrelated cookie families such as Drupal 6 parent-domain SESS names; see [`drupal6-parent-session-cookies.vcl`](../examples/vcl/drupal6-parent-session-cookies.vcl). When a request has parent and session cookies, the session remains; later CDN's `bypass remaining cookies` or RustProxy's default request-cookie guard prevents shared-cache reuse. The operator must verify that the listed name is never used by this Vhost; `Cookie` does not carry the originating Domain. The old whole-header public-Vhost template is no longer offered; remove any already-saved unsafe copy manually.
### Included opt-in CDN cookie policy