This commit is contained in:
Mateusz Gruszczyński committed 2026-11-20 19:51:27 +01:00
1 parent 15425fb803
commit 0fc9c0d239
21 files changed
+395 -36

No files matched your search

+16
View File
@@ -13,6 +13,14 @@ The **Static & diagnostics** subtab provides **Ignore request cookies for static
The cache rules template menu now includes **CDN technical cookies** for Cloudflare (`__cf_bm`, `cf_clearance`, `_cfuvid`, `__cfruid`, `__cfseq`) and Akamai (`_abck`, `ak_bmsc`, `bm_sz`, `bm_sv`). It bypasses non-GET/HEAD methods, restricted application paths and `Authorization`. It strips the entire Cookie header **only if all Cookie fields contain allowlisted technical cookies**, and bypasses any request with a remaining Cookie (for example `session`, `wordpress_logged_in_*`, CSRF tokens or other personalized cookies). The source equivalent is [`examples/vcl/cdn-technical-cookies.vcl`](../examples/vcl/cdn-technical-cookies.vcl). Import it only after reviewing warnings; enable the graphical template only on tested public Vhosts. Some challenge cookies (especially `cf_clearance`, `_abck` and `ak_bmsc`) are important to specific origin/CDN configurations; removing them can break a challenge flow. **This is not turned on automatically for existing Vhosts.**
### Inherited cookies on public Vhosts (opt-in, disabled by default)
A parent domain may set `Set-Cookie: name=value; Domain=.example.test`, causing browsers to send it to *all* subdomains. A received `Cookie` header contains only names and values: RustProxy **cannot determine the source Domain** or whether a cookie was set by the current subdomain. The preferred fix is to make the cookie host-only at the issuing application (omit `Domain`), if it is not meant for sibling hosts.
For a subdomain that serves **exclusively public, cookie-independent GET/HEAD pages**, the Vhost **Cache rules → Add from template → Public vhost: ignore inherited cookies** template is available. It is deliberately **disabled when added**, absent from the global template menu, and must be reviewed before enabling. The template strips **all incoming request cookies** before lookup **and** before forwarding to the origin, only for GET/HEAD with Cookie, without `Authorization`, and outside its conservative private-path exclusion regex. The path regex is only an example; adapt it to the application. Do not use on logged-in pages, language/session-dependent pages, checkout, downloads, CSRF or custom authenticated paths. A public page must return identical body and headers regardless of Cookie; otherwise do not enable the rule. The independently importable VCL equivalent is [`examples/vcl/public-vhost-ignore-cookies.vcl`](../examples/vcl/public-vhost-ignore-cookies.vcl).
This rule does not remove an origin `Vary: Cookie` header. Since Cookie has been removed from the request before lookup and the backend fetch, all eligible requests compare the **absent** Cookie variant. RustProxy still requires normal response eligibility: `Cache-Control` privacy, `Set-Cookie`, response `Vary`, authentication and route checks remain active. If the origin emits an unnecessary `Vary: Cookie` for a truly public page, correct it at the origin rather than unsetting all `Vary` in a deliver-stage rule. Avoid installing the new template *after* a same-scope early `pass` rule for Cookie: stop/return prevents later rules running. Prefer the **per-Vhost editor** and verify `X-Cache-Reason` with a real browser Cookie before rollout.
**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.
## `Vary` matching (RFC 9111 §4.1)
@@ -152,6 +160,14 @@ done
Look for cache reason labels including `request_cookie`, `request_authorization`, `response_cache_control`, `route_disabled` and `cache_hit` when diagnostic headers are enabled. A `MISS` alone does not prove the object was admitted to HOT/COLD.
### Browser differs from curl (HTML, cookies, reloads)
Compare **two consecutive normal GET navigations** to exactly the same URL and inspect **Network → request headers** and **response headers** in the browser. Use `X-Cache-Reason` to distinguish `request_cookie` (BYPASS) from `request_no_cache` / `request_max_age` (revalidation) and from `cache_miss` (no matching stored variant). A browser may send session/analytics cookies absent from a plain curl request. `Vary: Cookie` is an explicit instruction to partition cached representations by the complete incoming Cookie header; a VCL rule stripping *approved technical cookies* from the request does not remove application cookies or automatically suppress `Vary: Cookie` for HTML. Do not remove the latter or strip session cookies unless the application guarantees that both headers and body are identical for every visitor.
For a faithful command-line comparison, use **Copy as cURL** for a browser request and repeat the resulting command without changing its Cookie, `Accept-Encoding`, URL or request cache directives. Then test a second invocation with only irrelevant technical cookies omitted, if appropriate. Different compression/`Vary` representations may each have their own initial MISS. For manual reloads, check **Disable cache** in DevTools and `Cache-Control`/`Pragma` on the *request*. With the default `varnish_compatible=true`, only the supported reload directives are ignored for fresh lookup; `no-store`, Cookie bypass and credential policy are not ignored.
An eligible uncached `HEAD` is forwarded upstream as `GET` and can populate the same cache entry as a future GET. RustProxy returns the HEAD headers and drains the fetched body **without delivering it to the HEAD client**; the fill is asynchronous and bounded by the configured cache object size and a 30-second deadline. A GET requested before this fill has completed may still show MISS or wait for the in-flight fill; if the body exceeds the size/deadline or fails, no object is stored. HEAD responses to requests which bypass the cache are **not** drained by this mechanism.
### In-panel cache and VCL guide
Click **Cache & VCL guide** in **Settings → Cache**, **Vhosts → Cache** or a Docker service's **Cache** editor for the same interactive modal. The example-insertion target is the **editor that opened the modal** (global, ordinary vhost or Docker vhost), not always the global rules. The context badge identifies the destination, and the scope note explains which rules/settings are inherited and which are local. Opening the guide from a vhost does not save or modify global rules. It shows the **current form values** for compatibility mode, fallback TTL and grace, including a warning if the cache is disabled. The form may have unsaved changes; the modal does not apply settings. Example VCL snippets explain how `Cookie`, `Vary`, safe `req.http.*`, `beresp.http.*`, `resp.http.*`, `beresp.uncacheable = false` and `return(hash)` affect cache decisions. The **Insert into VCL importer** buttons copy a starting snippet into that editor's Rules import textarea (without importing or saving the rule) and invalidate older import previews; warnings now require explicit approval of a partial import. The guide warns that only 200 responses can be stored, and that VCL export is an approximate view. Validate the rule tester before saving. The modal explicitly lists unsupported VCL hooks and includes a short HIT/MISS/BYPASS checklist. For complete syntax, use [VCL import](VCL.md).
+1
View File
@@ -73,6 +73,7 @@ RustProxy is a single service that combines a reverse proxy, a static/PHP web se
- Optional minification of JavaScript, CSS, HTML, SVG and JSON with memory budgets.
![Cache](images/cache.png)
- Opt-in disabled-by-default per-Vhost template for fully public pages to ignore all inherited parent-domain cookies on GET/HEAD (with Authorization/private-path guards); no global cookie strip or source-domain guessing.
- 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
@@ -37,7 +37,7 @@ Guides for operating RustProxy: installation, publishing services, security, cer
## Performance and delivery
- [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.
- [VCL traffic cookbook](VCL_TRAFFIC_COOKBOOK.md) — 11 ready-to-import examples, public/private HTTP traffic cases, Cookie/`Vary` variants, `curl` verification and failure modes.
- [VCL traffic cookbook](VCL_TRAFFIC_COOKBOOK.md) — 12 ready-to-import examples, public/private HTTP traffic cases, 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.
+1
View File
@@ -20,6 +20,7 @@ Start with a reproducible request, its hostname/path and the exact listener. Com
| WebSocket handshake fails or disconnects | Vhost WebSockets flag, backend Upgrade support, TLS/frontend protocol path, WebSocket idle limits and auth redirect. |
| `403` / `405` / `429` | Applicable IP/ACL/country policy, HTTP methods, rate limit, GeoIP availability, Basic/Tinyauth permissions. |
| Cache always BYPASS or MISS | Global + Vhost enablement, cookies/login, origin `Cache-Control`, `Set-Cookie`, `Vary`, TTL, size and exclusion rules. |
| Browser misses cache while curl gets HIT | Inspect browser request `Cookie`, `Authorization`, `Cache-Control`, URL/query and `Accept-Encoding`; read `X-Cache-Reason`. Browser cookie bypass and `Vary: Cookie` variants differ from an anonymous curl GET. Do not strip application cookies from HTML to force sharing. |
| Content remains stale | Cache Age/resident age, origin validator, policy changes, matching scheme/Host/query and selected purge scope. |
| Static file not found | Document root, process read permissions, index files, symlink policy, `try_files` and rewrite ordering. |
| PHP returns errors or another site's PHP settings | FPM endpoint/socket permission, distinct pool/INI settings, pool restart, PHP `PATH_INFO`, application logs. |
+4 -4
View File
@@ -1,10 +1,10 @@
# VCL import: supported instructions and exact effects
This guide describes the VCL **subset implemented by RustProxy 0.39.0**, not the full Varnish Configuration Language. It is based on the VCL importer and cache-rule engine. Importing VCL **converts statements into graphical cache rules (which must then be saved)**; RustProxy does not execute arbitrary VCL text at request time. Unsupported instructions may be skipped with warnings or cause a parse error; they are not executed as Varnish code. **In the graphical importer, warnings pause conversion:** no rules are added until you explicitly choose **Add partial import (reviewed)**. Even after adding, you must separately save the configuration. The read-only VCL export is a human-oriented preview, **not** a lossless backup or a guaranteed re-importable VCL program.
This guide describes the VCL **subset implemented by RustProxy 0.39.1**, not the full Varnish Configuration Language. It is based on the VCL importer and cache-rule engine. Importing VCL **converts statements into graphical cache rules (which must then be saved)**; RustProxy does not execute arbitrary VCL text at request time. Unsupported instructions may be skipped with warnings or cause a parse error; they are not executed as Varnish code. **In the graphical importer, warnings pause conversion:** no rules are added until you explicitly choose **Add partial import (reviewed)**. Even after adding, you must separately save the configuration. The read-only VCL export is a human-oriented preview, **not** a lossless backup or a guaranteed re-importable VCL program.
For a short operational reference inside the panel, open **Cache & VCL guide** from **Settings → Cache**, the ordinary **Vhost → Cache** editor or **Docker vhosts → Cache**. The same modal works in all three places; example VCL is pasted into the importer of the editor that opened the guide, and the modal labels that scope. The modal shows the current compatibility-mode, fallback-TTL and grace settings, explains `Vary` and header mutations with examples, and identifies unsupported Varnish hooks. It complements this exact syntax reference; it does not execute VCL or save settings.
For an expanded **implemented / restricted / graphical-only / intentionally excluded / not implemented** inventory, consult the [complete VCL support matrix](VCL_SUPPORT_MATRIX.md). For practical production scenarios, **11 copyable VCL examples**, HTTP traffic outcomes, a `curl` validation plan and troubleshooting, use the [VCL traffic cookbook](VCL_TRAFFIC_COOKBOOK.md) (also available from the embedded Reader). It names each supported hook, variable and return action and the deliberate HTTP/security boundaries.
For an expanded **implemented / restricted / graphical-only / intentionally excluded / not implemented** inventory, consult the [complete VCL support matrix](VCL_SUPPORT_MATRIX.md). For practical production scenarios, **12 copyable VCL examples**, HTTP traffic outcomes, a `curl` validation plan and troubleshooting, use the [VCL traffic cookbook](VCL_TRAFFIC_COOKBOOK.md) (also available from the embedded Reader). It names each supported hook, variable and return action and the deliberate HTTP/security boundaries.
## Where to import, rule order and activation
@@ -147,14 +147,14 @@ sub vcl_recv {
}
```
Use `unset req.http.Cookie;` only when the origin does not need **any** cookies for that route. A graphical **Strip cookies** action can keep an allowlist (not imported from arbitrary VCL cookie rewriting). 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 public Vhost that receives cookies from its parent domain, see the [opt-in inherited-cookie recipe](VCL_TRAFFIC_COOKBOOK.md#12-public-vhost-inherited-cookies-opt-in). `Cookie` does not disclose the setting `Domain`, so this is an intentional all-cookie removal, not automatic recognition of inherited cookies. A graphical **Strip cookies** action can keep an allowlist (not imported from arbitrary VCL cookie rewriting). 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
- `varnish_compatible=true` and positive `cache.default_ttl_seconds` (or an explicit positive `set beresp.ttl`) may treat an otherwise eligible origin `Cache-Control: no-cache` as fresh for that TTL, **without requiring `public`**. This is RustProxy's configured override, **not** vanilla Varnish's built-in behavior.
- `varnish_compatible=false` honors `no-cache` revalidation, including when a TTL action is present. An explicit *backend header rewrite* removing `no-cache` changes the response policy in both modes; that is a different and potentially unsafe operation.
- Backend `private`, `no-store`, `Set-Cookie`, malformed `Vary`, unsupported status, invalid headers and size bounds still block storage **unless an administrator explicitly rewrites the affected cache-policy headers via trusted rules**. Client/request restrictions remain separate.
- **Only HTTP 200 origin responses are storable in RustProxy 0.39.0.** Setting `beresp.ttl` for `404`, `301` or `302` does not create a negative/redirect cache. The misleading 404 TTL template was removed from the graphical editor. Deliver-stage header rules can still edit those responses without making them cacheable.
- **Only HTTP 200 origin responses are storable in RustProxy 0.39.1.** Setting `beresp.ttl` for `404`, `301` or `302` does not create a negative/redirect cache. The misleading 404 TTL template was removed from the graphical editor. Deliver-stage header rules can still edit those responses without making them cacheable.
- Hit-for-miss / hit-for-pass and `beresp.keep` are intentionally not imported. RustProxy already coalesces eligible misses and briefly remembers uncacheable fills for its collapse strategy, and independently retains validators for conditional revalidation. These are **not** Varnish-compatible hit-for-miss/pass objects or programmable `keep` semantics.
## Test an imported rule set
+5 -1
View File
@@ -1,6 +1,6 @@
# 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.
**Applies to the RustProxy 0.39.1 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
@@ -205,6 +205,10 @@ The labels above distinguish explicit product limits from missing work; **not im
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 public-Vhost inherited-cookie policy
The graphical **Public vhost: ignore inherited cookies** template (`src/admin/web/cache-rules.js`) is available only in local Vhost/Docker Vhost rule editors and inserted disabled. It deliberately drops the **entire** Cookie header on public GET/HEAD requests, and only if the request does not carry Authorization and the path does not match the operator-reviewed private-path exclusions. It also asks for lookup and stops later request-stage rules. The VCL equivalent is [`examples/vcl/public-vhost-ignore-cookies.vcl`](../examples/vcl/public-vhost-ignore-cookies.vcl). The normal request/response eligibility guards still apply; no shared-cache use of private/no-store or Set-Cookie responses is authorized. The issuing application's host-only `Set-Cookie` is preferable whenever possible. The original cookie's Domain is not transmitted in HTTP Cookie and cannot be inferred; this is a broad, high-impact opt-in rule, not an automatic safe way to discard only parent-domain cookies.
### 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.
+49 -4
View File
@@ -1,6 +1,6 @@
# VCL cookbook: concrete use cases and HTTP traffic scenarios
**Target:** RustProxy **0.39.0** with the Docker Cache/Traffic and CDN cookie patch. This guide documents the *actual importer* (`src/cache/vcl.rs`), validated cache-rule actions (`src/cache/rules.rs`), and shared-cache admission documented in [Cache](CACHE.md). It is **not** a full Varnish implementation or a promise of exact Varnish semantics.
**Target:** RustProxy **0.39.1** with the Docker Cache/Traffic and CDN cookie patch. This guide documents the *actual importer* (`src/cache/vcl.rs`), validated cache-rule actions (`src/cache/rules.rs`), and shared-cache admission documented in [Cache](CACHE.md). It is **not** a full Varnish implementation or a promise of exact Varnish semantics.
Read together with [VCL compatibility](VCL.md) and the [supported/unsupported capability matrix](VCL_SUPPORT_MATRIX.md). The examples are **separate policies**, not one file that should be imported wholesale. Copy one recipe into the correct Vhost scope, then reconcile it with existing global/local rules; **never paste contradictory `return(pass)` policies together without reviewing rule order**.
@@ -31,6 +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 inherited from a parent domain on a **fully public** Vhost | [Public Vhost inherited cookies](#12-public-vhost-inherited-cookies-opt-in) | Remove **all** Cookie for eligible GET/HEAD after operator review | Detect which cookies came from a parent domain; guarantee safe login/personalization routes |
| Cloudflare/Akamai technical cookies | [CDN cookie allowlist](#4-cdn-technical-cookies-without-dropping-sessions) | Strip an **entire** allowlisted Cookie header | Partially delete one Cookie from a mixed list |
| 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 |
@@ -40,7 +41,7 @@ Read together with [VCL compatibility](VCL.md) and the [supported/unsupported ca
| Remove tracking parameters from cache identity | [Query rewrite](#10-tracking-query-normalization-restricted) or graphical Strip query | Drop approved params after URL normalization | Import arbitrary `regsub` or preserve regex URL semantics exactly |
| Origin sets irrelevant `Set-Cookie` on public SVG | [Advanced public cookie cleanup](#11-advanced-removing-origin-set-cookie-high-risk) | Remove it before storage | Prove it was not needed for identity/session |
| CORS responses differentiated by `Origin` | Origin's `Vary: Origin` | Keep origins separate | Safely collapse all origins into one cached response |
| Cache error pages/redirects (`404`, `301`, `302`) | **Not supported** | No cache storage in 0.39.0 | Invent negative/redirect-cache TTL via VCL |
| Cache error pages/redirects (`404`, `301`, `302`) | **Not supported** | No cache storage in 0.39.1 | Invent negative/redirect-cache TTL via VCL |
| IP ranges, backend routing, purge, TLS security | Native ACL/Vhost/Cache API settings | Dedicated supported configuration | Import ACL/director/`return(purge)` as executable VCL |
## C. Copy-and-import VCL recipes
@@ -300,7 +301,7 @@ sub vcl_hash {
**Prerequisites:** Use native proxy/WebSocket/stream and backend retry configuration for those separate operations.
**Caveat:** This is not a Varnish `vcl_backend_error`, retry, pipe or stale-if-error implementation. `500` was never eligible for 0.39.0 shared storage anyway.
**Caveat:** This is not a Varnish `vcl_backend_error`, retry, pipe or stale-if-error implementation. `500` was never eligible for 0.39.1 shared storage anyway.
Source: [`examples/vcl/stream-and-errors-no-store.vcl`](../examples/vcl/stream-and-errors-no-store.vcl).
@@ -402,6 +403,42 @@ sub vcl_backend_response {
}
```
### 12. Public Vhost: inherited cookies (opt-in)
**Goal:** Keep cache working on a completely public site when a browser includes unrelated cookies set with `Domain=.example.test` by another host. This is generic for any hostname; **it cannot detect the cookie's original Domain**, which is not part of the HTTP `Cookie` request header.
**Expected traffic:** `GET /catalog`, `Cookie: parent_session=x; analytics=y` → Cookie stripped before cache lookup and before origin forwarding. The origin serves its anonymous public representation; an eligible repeat GET may HIT. `GET /account` or a request with `Authorization` keeps its cookies and follows normal bypass/auth policies. POST is unaffected.
**Prerequisites:** Use the per-Vhost cache rule editor, confirm that the *entire eligible area* is public for guests and logged-in users, and extend the excluded path regex to cover **all** private routes of the application. The graphical template is **disabled by default** until manually enabled. Avoid installing it globally or after existing terminal Cookie `pass` rules. The safest fix is often to remove the broad `Domain` attribute from `Set-Cookie` at the issuing application so browsers no longer send unrelated cookies to siblings.
**Caveat:** This deliberately removes **every** cookie on the allowed public pages, not just analytics or inherited cookies. It can break logins, preferences, locale choice, cart, stickiness or security challenge behavior, and may serve anonymous content to a logged-in user. Never apply it to personalized content. It does not rewrite origin `Vary: Cookie`, `Set-Cookie` or `Cache-Control` and does not bypass RustProxy response privacy checks. Use [`docs/CACHE.md`](CACHE.md#inherited-cookies-on-public-vhosts-opt-in-disabled-by-default) for configuration and risk details.
Source: [`examples/vcl/public-vhost-ignore-cookies.vcl`](../examples/vcl/public-vhost-ignore-cookies.vcl).
```vcl
// OPT-IN: use ONLY on an HTTP reverse-proxy Vhost with fully public,
// cookie-independent GET/HEAD content. Import into that Vhost, NOT globally.
// Useful when a parent domain sets Domain=.example.test cookies that a public
// sibling subdomain neither needs nor should forward to the backend.
//
// Cookie does not include the cookie's Domain attribute. It is IMPOSSIBLE
// to distinguish inherited cookies from host-only cookies in vcl_recv.
// This deliberately strips ALL cookies on permitted public paths; verify
// that users do not need login, preferences, locale, cart or affinity there.
// Customize the excluded path list to fit your application before enabling.
// Backend must return an eligible PUBLIC response (no private/no-store or
// Set-Cookie); this does not override response cache privacy or Vary.
sub vcl_recv {
if ((req.method == "GET" || req.method == "HEAD") &&
req.http.Cookie &&
!req.http.Authorization &&
req.url !~ "^/(admin|api|auth|login|logout|account|profile|user|settings|dashboard|cart|checkout|panel|konto|wp-admin|wp-login[.]php)(/|[?]|$)") {
unset req.http.Cookie;
return(hash);
}
}
```
## D. Real HTTP traffic: what is handled and what is not
The outcomes below describe **decision paths**, not a guaranteed X-Cache label: proxy route exclusions, access checks, configuration, origin responses, object sizes, validators, time, and storage limits still apply. The word **eligible** means the request may look up or populate cache if all other conditions succeed.
@@ -423,6 +460,9 @@ The outcomes below describe **decision paths**, not a guaranteed X-Cache label:
| `Cookie: __cf_bm=a; cf_clearance=b` | CDN cookie allowlist | Strip whole Cookie header | Only exact allowlisted cookie names pass. |
| `Cookie: __cf_bm=a; session=b` | CDN cookie allowlist | PASS | Even one non-allowlisted name prevents removal. |
| Two physical Cookie fields, one technical and one session | CDN cookie allowlist | PASS | Patched matcher examines combined cookie values. |
| `GET /catalog`, Cookie from parent domain | Public-Vhost opt-in | Strip all Cookie; eligible | Only on verified cookie-independent pages with reviewed exclusions. |
| `GET /account`, parent-domain Cookie | Public-Vhost opt-in | Ordinary bypass/auth rules | Protected-path guard leaves Cookie untouched. |
| `GET /catalog`, Cookie plus Authorization | Public-Vhost opt-in | Native auth/bypass | The template does not remove Cookie with Authorization. |
| `GET /assets/site.css`, arbitrary Cookie | Public static | Strip Cookie **if verified safe** | Separate native `Vary: Cookie` setting has additional conditions. |
| `GET /assets/user-avatar.png`, Cookie | Do **not** use static bypass | PASS recommended | Do not remove session personalization merely due to extension. |
| `GET /experiment`, `X-Experiment: A` | A/B variants | Eligible A partition | Origin must emit downstream `Vary: X-Experiment`. |
@@ -432,7 +472,7 @@ The outcomes below describe **decision paths**, not a guaranteed X-Cache label:
### D2. Origin response and `Vary`
| Backend sends | RustProxy 0.39.0 consequence | Safety check |
| Backend sends | RustProxy 0.39.1 consequence | Safety check |
|---|---|---|
| `200`, public/fresh, no Set-Cookie, valid Vary | Potential shared-store candidate | Response must really be identical for all users. |
| `200`, `Cache-Control: private` | Not storable without **dangerous explicit rewrite** | Never rewrite private content to public. |
@@ -507,6 +547,11 @@ curl -sS -o /dev/null -D - "$BASE/catalog/item/1"
curl -sS -o /dev/null -D - -H 'Cookie: session=test' "$BASE/catalog/item/1"
curl -sS -o /dev/null -D - -H 'Authorization: Bearer test' "$BASE/catalog/item/1"
# Optional public-Vhost template (after explicitly enabling and reviewing paths):
# browser-equivalent Cookie is removed for genuinely public pages.
curl -sS -o /dev/null -D - -H 'Cookie: parent_session=abc' "$BASE/catalog/item/1"
curl -sS -o /dev/null -D - -H 'Cookie: parent_session=abc' "$BASE/catalog/item/1"
# Technical-only cookies vs mixed cookies: inspect origin logs as well.
curl -sS -o /dev/null -D - -H 'Cookie: __cf_bm=test' "$BASE/catalog/item/1"
curl -sS -o /dev/null -D - -H 'Cookie: __cf_bm=test; session=test' "$BASE/catalog/item/1"