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

+4 -4
View File
@@ -11,7 +11,7 @@ The **Static & diagnostics** subtab provides **Ignore request cookies for static
### Ready-made quick rules library
The **Add from template** dropdown is grouped by scenario. **Browse scenarios** opens a searchable panel with descriptions and one-click **Add** buttons for ready-made request, response and delivery rules. The library includes common application sessions, WordPress/WooCommerce, Django, Laravel, Auth.js, API and private routes, SSE/webhooks, TTL for verified public content and defensive headers. Some scenarios add multiple rules. Templates with a risk of unexpected shared-cache reuse are **disabled until reviewed**. The CDN and exact-name parent-domain cookie templates stay separate. See [Quick rules template library](CACHE_TEMPLATE_LIBRARY.md) for categories, order, defaults and tests. Adding rules changes the draft; save settings before relying on them.
The **Add from template** dropdown is grouped by scenario. **Browse scenarios** opens a searchable panel with descriptions and one-click **Add** buttons for ready-made request, response and delivery rules. The library includes common application sessions, WordPress/WooCommerce, Django, Laravel, Auth.js, API and private routes, SSE/webhooks, TTL for verified public content and defensive headers. Some scenarios add multiple rules. Templates with a risk of unexpected shared-cache reuse are **disabled until reviewed**. The CDN and selective parent-domain cookie templates stay separate. See [Quick rules template library](CACHE_TEMPLATE_LIBRARY.md) for categories, order, defaults and tests. Adding rules changes the draft; save settings before relying on them.
### CDN security cookies (opt-in VCL template)
@@ -23,14 +23,14 @@ A parent domain may set `Set-Cookie: name=value; Domain=.example.test`, making b
Two **separate** opt-in templates remain available in the Vhost cache-rule editor:
1. **Vhost: remove selected parent-domain cookies** (inserted **disabled**): the operator supplies an exact comma-separated list of **non-session** cookie names in the `Remove only named cookies` action, replacing `REPLACE_WITH_VERIFIED_PARENT_COOKIE_NAME`. Only those names are removed from incoming GET/HEAD requests; every other cookie, including the application's session, stays intact. The rule has **no** `return(hash)` and **does not stop** subsequent cache rules. It excludes Authorization and example private paths; review the path list for your application. The example is [`examples/vcl/public-vhost-remove-parent-cookies.vcl`](../examples/vcl/public-vhost-remove-parent-cookies.vcl).
1. **Vhost: remove selected parent-domain cookies** (inserted **disabled**): the operator supplies verified comma-separated cookie names or trailing-`*` prefixes in the `Remove selected cookies` action, replacing `REPLACE_WITH_VERIFIED_PARENT_COOKIE_NAME`. Only matching names are removed from incoming GET/HEAD requests; every other cookie, including the application's session, stays intact. The rule has **no** `return(hash)` and **does not stop** subsequent cache rules. It excludes Authorization and example private paths; review the path list for your application. The example is [`examples/vcl/public-vhost-remove-parent-cookies.vcl`](../examples/vcl/public-vhost-remove-parent-cookies.vcl).
2. **CDN technical cookies** (independent, unchanged): its safe-method/private-path/Authorization guards, its anchored whole-header CDN cookie allowlist and **CDN: bypass remaining cookies** continue to run after parent cookie removal. It never treats a remaining session cookie as a CDN cookie. See [`examples/vcl/cdn-technical-cookies.vcl`](../examples/vcl/cdn-technical-cookies.vcl).
**Order:** place the parent-name rule **above** `CDN: remove ONLY technical cookies` and especially **above** `CDN: bypass remaining cookies`; leave the CDN guard rules active at the top. **Delete/disable any old `Public vhost: ignore inherited cookies` rule that uses `strip_cookies: keep=[]` + `lookup`**. Updating the binary does not remove existing saved rules. Never add an application session cookie, login token, CSRF token, locale/personalization cookie or sticky-session identifier to the parent-name list. Do not wildcard cookie names. If the same cookie name can belong to the parent **and** this application, use host-only cookies at the issuer instead of the removal rule.
**Order:** place the parent-cookie rule **above** `CDN: remove ONLY technical cookies` and especially **above** `CDN: bypass remaining cookies`; leave the CDN guard rules active at the top. **Delete/disable any old `Public vhost: ignore inherited cookies` rule that uses `strip_cookies: keep=[]` + `lookup`**. Updating the binary does not remove existing saved rules. Never add an application session cookie, login token, CSRF token, locale/personalization cookie or sticky-session identifier to the parent-name list. The only supported wildcard is a **single trailing `*`** (a case-sensitive prefix). For example, `SESS*` or `SSESS*` can discard Drupal 6 cookies from an unrelated parent application, but **only if this Vhost never relies on that cookie family**. Interior wildcards, `*` alone, prefixes shorter than 3 characters and arbitrary regexes are rejected. If the same cookie name or prefix can belong to the parent **and** this application, use host-only cookies at the issuer instead of the removal rule.
Resulting request behavior on public pages: `Cookie: parent_marketing=1` (listed) → stripped → cache eligible; `Cookie: parent_marketing=1; __cf_bm=2` → parent removed by this rule, then CDN removed by its separate template → eligible; `Cookie: parent_marketing=1; app_session=abc` → only parent removed, session retained → CDN remaining-cookie rule **BYPASS**; POST, Authorization and private paths are not rewritten by the new template. Verify each using **Cache rule tester** and live `X-Cache-Reason` headers. Responses with `Set-Cookie`, `private` or `no-store` still cannot enter shared storage. The origin's `Vary: Cookie` stays intact and is evaluated against the **remaining** Cookie value. Configure logged-in origin responses as `private, no-store` as defense in depth.
The import syntax `remove_req_cookies("name1", "name2");` is a **RustProxy-specific VCL extension**, not stock Varnish syntax. It performs exact, case-sensitive name matching, preserves other cookies, and refuses to rewrite malformed Cookie fields. A graphical `Remove only named cookies` action uses the same implementation. This new action is not the dangerous `Strip cookies` / "keep" operation, which can remove other cookies.
The import syntax `remove_req_cookies("name1", "name2");` is a **RustProxy-specific VCL extension**, not stock Varnish syntax. It performs exact, case-sensitive name matching or a case-sensitive prefix match for a **single trailing `*`**, preserves other cookies, and refuses to rewrite malformed Cookie fields. The graphical `Remove selected cookies` action uses the same implementation. For a Drupal 6 parent domain with local `session` cookies, see [`examples/vcl/drupal6-parent-session-cookies.vcl`](../examples/vcl/drupal6-parent-session-cookies.vcl). This new action is not the dangerous `Strip cookies` / "keep" operation, which can remove other cookies.
**Do not extend** `Ignore Vary: Cookie for public static assets` to a general "Ignore Vary" control. `Accept-Encoding`, `Accept-Language`, `Accept`, `Origin`, `User-Agent` and custom response-specific dimensions can change bytes, permissions or CORS headers. Keep the response's actual dimensions and use the existing safe normalization of recognized list fields below, or remove an unnecessary `Vary` at the origin only after proving the response is invariant. A VCL `unset beresp.http.Vary` is *possible*, but it is not the equivalent of a guarded static-file optimization.
+2 -2
View File
@@ -57,7 +57,7 @@ A framework template recognizes only the listed paths or cookie names. Where a s
| Template (internal key) | Rules / default | Exact effect | Deployment notes |
|---|---|---|---|
| **CDN technical cookies** (`cdn`) | 5 request rules, all **On** | `pass` non-GET/HEAD; `pass` `/admin`, `/api`, `/auth`, `/login`, `/logout`, `/panel`, `/konto`, `/dashboard`; `pass` `Authorization`; strip **the entire Cookie header only if every cookie name** belongs to the fixed Cloudflare/Akamai technical list; then `pass` if any Cookie remains. | Do not replace the anchored allowlist with a contains/substring match. Cookie names: `__cf_bm`, `cf_clearance`, `_cfuvid`, `__cfruid`, `__cfseq`, `_abck`, `ak_bmsc`, `bm_sz`, `bm_sv`. Use only if those values are irrelevant to the origin's representation. |
| **Selected parent-domain cookies** (`publiccookies`) | 1 request rule, **Off**; **Vhost-only** | Only on GET/HEAD with Cookie, without Authorization and outside specified private prefixes: remove **only exact cookie names** entered by the operator; no forced cache lookup and no `stop`. | Replace `REPLACE_WITH_VERIFIED_PARENT_COOKIE_NAME` with verified, nonsession names. Other cookies remain and can trigger the CDN remaining-cookie `pass` guard. |
| **Selected parent-domain cookies** (`publiccookies`) | 1 request rule, **Off**; **Vhost-only** | Only on GET/HEAD with Cookie, without Authorization and outside specified private prefixes: remove **only selected exact cookie names or trailing-`*` prefixes** entered by the operator; no forced cache lookup and no `stop`. | Replace `REPLACE_WITH_VERIFIED_PARENT_COOKIE_NAME` with verified names or prefixes (e.g. `SESS*` for an unrelated Drupal 6 parent, never if this Vhost uses Drupal sessions). Other cookies remain and can trigger the CDN remaining-cookie `pass` guard. |
**Safe order for a Vhost using both:**
@@ -70,7 +70,7 @@ A separate **Any Cookie** guard should also follow the cookie cleanup if used. T
**Why names must be verified:** request `Cookie` carries *names and values*, not the `Domain` attribute that originally set the cookie. RustProxy cannot automatically tell whether it came from a parent host. If the parent site and application use the **same** cookie name for different purposes, name-based deletion is unsafe. Prefer host-only cookies at the issuer or an explicit per-route design instead. Removing a Cookie changes both the cache decision **and** what the backend receives.
For copyable VCL syntax, see [parent-domain cookie removal](VCL_TRAFFIC_COOKBOOK.md#12-parent-domain-cookies-remove-selected-names-opt-in), [`public-vhost-remove-parent-cookies.vcl`](../examples/vcl/public-vhost-remove-parent-cookies.vcl) and [`cdn-technical-cookies.vcl`](../examples/vcl/cdn-technical-cookies.vcl). The selective `remove_req_cookies(...)` instruction is a **RustProxy extension**, not standard Varnish VCL.
For copyable VCL syntax, see [parent-domain cookie removal](VCL_TRAFFIC_COOKBOOK.md#12-parent-domain-cookies-remove-selected-names-opt-in), [`public-vhost-remove-parent-cookies.vcl`](../examples/vcl/public-vhost-remove-parent-cookies.vcl) and [`cdn-technical-cookies.vcl`](../examples/vcl/cdn-technical-cookies.vcl). The selective `remove_req_cookies(...)` instruction accepts exact names and a single trailing wildcard (`prefix*`) and is a **RustProxy extension**, not standard Varnish VCL. For Drupal 6 parent cookies see [`drupal6-parent-session-cookies.vcl`](../examples/vcl/drupal6-parent-session-cookies.vcl).
## 4. Public content and cache TTL (10 scenarios)
+1 -1
View File
@@ -74,7 +74,7 @@ RustProxy is a single service that combines a reverse proxy, a static/PHP web se
![Cache](images/cache.png)
- Searchable **quick-rule template gallery** in global/Vhost/Docker cache editors: grouped ready-made session/privacy, CMS/framework, CDN/parent-cookie, API/GraphQL, public TTL, static assets and response-header scenarios. Risky cache-acceleration templates are disabled until reviewed; examples are documented in [Quick rules library](CACHE_TEMPLATE_LIBRARY.md).
- Separate disabled-by-default per-Vhost template for exact-name removal of verified non-session parent-domain cookies; unrelated/session cookies survive and the unchanged CDN template can independently strip CDN-only cookies or bypass remaining sessions. No automatic cookie Domain detection.
- Separate disabled-by-default per-Vhost template for exact-name or single trailing-prefix (`SESS*`) removal of verified unrelated parent-domain cookies; unrelated/session cookies survive and the unchanged CDN template can independently strip CDN-only cookies or bypass remaining sessions. No automatic cookie Domain detection.
- CDN security-cookie template (Cloudflare and Akamai) that strips whole Cookie headers only when every cookie is allowlisted, with session/Authorization/path bypass; opt-in for verified public content. The [VCL support matrix](VCL_SUPPORT_MATRIX.md) documents supported and deliberately excluded constructs.
- **VCL subset only:** graphical rules are the canonical configuration. Partial imports require review; the VCL text shown in the editor is an approximate preview. Cache storage is restricted to HTTP 200 (non-200 responses can still receive deliver-header rules). See [VCL import](VCL.md).
+1 -1
View File
@@ -38,7 +38,7 @@ Guides for operating RustProxy: installation, publishing services, security, cer
- [Cache](CACHE.md) — scope-aware Cache & VCL help modal from global/Vhost/Docker editors, a compact rule tester, HOT/COLD cache, RFC 9111 `Vary` matching/normalization, safe static-asset cookie exceptions, freshness, `Cache-Status` and invalidation.
- [Quick rules template library](CACHE_TEMPLATE_LIBRARY.md) — searchable grouped scenarios for sessions, CDN/parent cookies, frameworks, public APIs, assets, no-store and security headers; defaults, risks and smoke tests.
- [VCL traffic cookbook](VCL_TRAFFIC_COOKBOOK.md) — 12 ready-to-import examples, separate name-selective parent-domain and CDN cookie rules, Cookie/`Vary` variants, `curl` verification and failure modes.
- [VCL traffic cookbook](VCL_TRAFFIC_COOKBOOK.md) — 12 cookbook recipes plus a Drupal 6 prefix-cookie example, separate parent-domain and CDN cookie rules, Cookie/`Vary` variants, `curl` verification and failure modes.
- [Complete VCL support matrix](VCL_SUPPORT_MATRIX.md) — line-by-line supported, restricted, graphical-only, intentionally excluded and missing instructions, with test scenarios.
- [VCL compatibility and header overrides](VCL.md) — supported VCL import syntax, safe request-header edits, `beresp.uncacheable` precedence, `Vary`, cookies, approval of partial imports and storage limits.
- [Response delivery](RESPONSE_DELIVERY.md) — compression, transformations and response headers.
+3 -3
View File
@@ -21,7 +21,7 @@ For the **complete reference to all 42 quick-rule templates** (conditions, stage
| `vcl_recv` | `return(pass);` | Stops request processing for the matching path; bypasses shared cache. |
| `vcl_recv` | `return(hash);` or `return(lookup);` | Stops `vcl_recv` and requests a cache lookup. In compatibility mode, may admit a GET/HEAD carrying `Cookie` (with cookie-partitioned variants); other protections remain. |
| `vcl_recv` | `unset req.http.Cookie;` | Removes the **whole** request Cookie header, including what is forwarded to the origin. |
| `vcl_recv` | `remove_req_cookies("parent_analytics");` | **RustProxy extension:** removes only the specified exact-name cookie(s) from the request before later rules, cache lookup and origin forwarding. Remaining session cookies are not removed and can still trigger BYPASS. Not standard Varnish VCL. |
| `vcl_recv` | `remove_req_cookies("parent_analytics", "SESS*");` | **RustProxy extension:** removes exact-name cookies or case-sensitive prefixes marked by one trailing `*` before later rules, cache lookup and origin forwarding. Remaining session cookies are not removed and can still trigger BYPASS. Not standard Varnish VCL. |
| `vcl_recv` | `set req.http.X-Device = "mobile";` / `unset req.http.X-Tracking;` | Sets/removes a **safe request header** before later conditions, `vcl_hash`, cache policy and the forwarded origin request. Assignments are constant strings, and a per-vhost edit takes priority over a conflicting global edit. Authentication, identity, request cache policy and transport headers are protected (see below). |
| `vcl_recv` | `set req.url = regsuball(req.url, "([?&])(utm_[^=&]*|gclid)=[^&]*", "\1");` | **Restricted conversion only:** recognizes the specific captured-separator, query-parameter-removal pattern. Other `regsub` / `regsuball` rewrites are skipped with warnings; arbitrary URL regex replacement is not supported. |
| `vcl_hash` | `hash_data(req.http.X-Name);` | Adds one request header's value to RustProxy's **internal** variant key. It does not automatically add `Vary` for downstream caches. |
@@ -56,7 +56,7 @@ sub vcl_hash {
Both header edits are visible to later matching rules, the hash calculation and the origin. They also run on cache-disabled reverse-proxy routes (without enabling cache). They **do not** rewrite the client's original `Vary` requirements: if the response varies by `X-Device`, include it in `beresp.http.Vary` or configure it at the origin. A later `unset` is different from setting an empty string.
Protected request headers cannot be set or removed by general request rules: `Authorization`, `Cookie` (except dedicated whole-header `unset` or exact-name `remove_req_cookies(...)` actions), `Cache-Control`, `Pragma`, `Host`, range/precondition headers (`If-*`, `Range`), forwarding and origin identity headers (`Forwarded`, `Via`, `X-Forwarded-*`, `X-Real-IP`, `X-Client-IP`, `CF-Connecting-IP`, `True-Client-IP`), `Proxy-*`, `Sec-*`, `X-RustProxy-*`, `Content-Type`, `Expect` and the protected transport/body header list below. Rejected edits are warned about and never silently applied. Do not assume imported VCL can change authentication or request-cache restrictions.
Protected request headers cannot be set or removed by general request rules: `Authorization`, `Cookie` (except dedicated whole-header `unset` or selective `remove_req_cookies(...)` actions), `Cache-Control`, `Pragma`, `Host`, range/precondition headers (`If-*`, `Range`), forwarding and origin identity headers (`Forwarded`, `Via`, `X-Forwarded-*`, `X-Real-IP`, `X-Client-IP`, `CF-Connecting-IP`, `True-Client-IP`), `Proxy-*`, `Sec-*`, `X-RustProxy-*`, `Content-Type`, `Expect` and the protected transport/body header list below. Rejected edits are warned about and never silently applied. Do not assume imported VCL can change authentication or request-cache restrictions.
The query-removal conversion accepts only the supported captured-separator `regsuball` pattern. **Every such conversion emits a warning**, because removing parameters with RustProxy's parser can normalize separators differently from a regex replacement. Variable-name classes such as `utm_[a-z]+` are approximated by a prefix wildcard; value patterns ending in `[^&]+` may preserve empty values that `strip_query` removes. **Review generated parameters and warnings** if byte-exact URL behavior matters. Other URL rewrites are deliberately **not** guessed from keywords such as `utm_`.
@@ -148,7 +148,7 @@ sub vcl_recv {
}
```
Use `unset req.http.Cookie;` only when the origin does not need **any** cookies for that route. For a Vhost that receives cookies from a parent domain, prefer the [name-selective opt-in recipe](VCL_TRAFFIC_COOKBOOK.md#12-parent-domain-cookies-remove-selected-names-opt-in): `remove_req_cookies("exact_cookie_name");` is a **RustProxy-specific extension** that removes only named cookies, preserving session and other cookies for later rules. The separate CDN technical-cookie policy still has its own anchored allowlist and remaining-cookie pass. `Cookie` does not disclose the setting `Domain`, so a name must be verified outside RustProxy; avoid removing a name also used by this Vhost. A graphical **Strip cookies** action keeps an allowlist but is not equivalent to selective removal. In strict RFC mode (`cache.varnish_compatible=false`), `return(hash)` does not bypass the request Cookie restriction. `Authorization`, non-GET/HEAD traffic, request `no-store`, access/authentication and sticky-session checks still apply.
Use `unset req.http.Cookie;` only when the origin does not need **any** cookies for that route. For a Vhost that receives cookies from a parent domain, prefer the [name-selective opt-in recipe](VCL_TRAFFIC_COOKBOOK.md#12-parent-domain-cookies-remove-selected-names-opt-in): `remove_req_cookies("exact_cookie_name", "SESS*");` is a **RustProxy-specific extension** that removes exact names or a single trailing-`*` prefix, preserving other cookies for later rules. Use `SESS*` only when the Vhost never uses that session family; see the [Drupal 6 parent-domain example](../examples/vcl/drupal6-parent-session-cookies.vcl). The separate CDN technical-cookie policy still has its own anchored allowlist and remaining-cookie pass. `Cookie` does not disclose the setting `Domain`, so a name must be verified outside RustProxy; avoid removing a name also used by this Vhost. A graphical **Strip cookies** action keeps an allowlist but is not equivalent to selective removal. In strict RFC mode (`cache.varnish_compatible=false`), `return(hash)` does not bypass the request Cookie restriction. `Authorization`, non-GET/HEAD traffic, request `no-store`, access/authentication and sticky-session checks still apply.
## `no-cache` and TTL
+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
+4 -4
View File
@@ -31,7 +31,7 @@ Read together with [VCL compatibility](VCL.md) and the [supported/unsupported ca
| CMS articles or a public catalog | [Public catalog](#2-public-catalog-with-explicit-short-ttl) | Cache genuinely shared 200 GETs, set TTL/grace | Force storage of `private`, `Set-Cookie` or 404 |
| Public JSON endpoint for prices/stock | [Public JSON API](#3-public-get-json-api) | Short-lived shared cache | Cache credentialed/private API responses |
| Admin, login, checkout, user dashboard | [Private routes](#1-exclude-private-routes-and-unsafe-methods) | Bypass shared cache | Replace ACL, OIDC, Basic Auth, app permissions |
| Cookies set broadly by a parent domain | [Selective parent cookie removal](#12-parent-domain-cookies-remove-selected-names-opt-in) | Remove only **verified exact cookie names**, leaving application sessions intact | Infer which Domain set them; safely delete an overlapping session cookie name |
| Cookies set broadly by a parent domain | [Selective parent cookie removal](#12-parent-domain-cookies-remove-selected-names-opt-in) | Remove only **verified names or trailing-`*` prefixes**, leaving application sessions intact | Infer which Domain set them; safely delete an overlapping session cookie name |
| Cloudflare/Akamai technical cookies | [CDN cookie allowlist](#4-cdn-technical-cookies-without-dropping-sessions) | Strip an **entire** CDN-only Cookie header; separate from parent cookie rule | Treat unknown or session cookies as CDN cookies |
| Public CSS, JS, fonts, images | [Static assets](#5-static-assets-and-vary-cookie) + native static settings | Strip request Cookie if proven safe; optional **conditional** `Vary: Cookie` treatment | Override any other arbitrary `Vary` dimension |
| Multilingual catalog | [Language variants](#6-language-specific-representations) | Preserve origin `Vary: Accept-Language` and separate variants | Automatically translate or change language |
@@ -409,11 +409,11 @@ sub vcl_backend_response {
**Expected traffic:** `GET /catalog` with `parent_marketing=1; app_session=abc` → remove `parent_marketing`, preserve `app_session`, and then the separate CDN **remaining cookies** rule causes `BYPASS`. With only `parent_marketing=1`, RustProxy may cache eligible anonymous content. With `parent_marketing=1; __cf_bm=2`, the parent rule removes the first and the separate CDN rule removes the second; this allows normal cache lookup. POST, protected paths and Authorization are unaffected.
**Prerequisites:** On the Vhost, add **Vhost: remove selected parent-domain cookies**, replace `REPLACE_WITH_VERIFIED_PARENT_COOKIE_NAME` with the actual verified cookie names in **Remove only named cookies**, review sensitive paths, then enable. Keep the CDN template as its **own group of rules**, with this new rule above `CDN: remove ONLY technical cookies` and `CDN: bypass remaining cookies`. Do not enable a previous **ignore ALL inherited cookies** rule: it could strip login sessions and force cache lookup. Removing that old rule from existing saved configurations is manual.
**Prerequisites:** On the Vhost, add **Vhost: remove selected parent-domain cookies**, replace `REPLACE_WITH_VERIFIED_PARENT_COOKIE_NAME` with the verified cookie names or single trailing-`*` prefixes in **Remove selected cookies**, review sensitive paths, then enable. Keep the CDN template as its **own group of rules**, with this new rule above `CDN: remove ONLY technical cookies` and `CDN: bypass remaining cookies`. Do not enable a previous **ignore ALL inherited cookies** rule: it could strip login sessions and force cache lookup. Removing that old rule from existing saved configurations is manual.
**Caveat:** A cookie name may be shared by both the parent and the application; if so, do not strip it by name. This is a RustProxy-specific VCL extension rather than standard Varnish VCL. Origin privacy guards, `Set-Cookie`, and `Vary` remain active. See [Cache](CACHE.md#parent-domain-cookies-opt-in-per-vhost-name-filtering).
**Caveat:** A cookie name or prefix may be shared by both the parent and the application; if so, do not strip it by name. This is a RustProxy-specific VCL extension rather than standard Varnish VCL. Origin privacy guards, `Set-Cookie`, and `Vary` remain active. See [Cache](CACHE.md#parent-domain-cookies-opt-in-per-vhost-name-filtering).
Source: [`examples/vcl/public-vhost-remove-parent-cookies.vcl`](../examples/vcl/public-vhost-remove-parent-cookies.vcl).
Source: [`examples/vcl/public-vhost-remove-parent-cookies.vcl`](../examples/vcl/public-vhost-remove-parent-cookies.vcl). For a parent Drupal 6 site with dynamic `SESS<hash>` names and a separate local `session` cookie, use the [Drupal 6 example](../examples/vcl/drupal6-parent-session-cookies.vcl): it removes `SESS*`/`SSESS*` while explicitly bypassing on `session`. This example requires the prefix-selector-enabled 0.39.1 binary, not an earlier unpatched build. The CDN policy remains separate.
```vcl
// Opt-in Vhost-only rule, SEPARATE from the CDN technical-cookie template.