This commit is contained in:
Mateusz Gruszczyński committed 2026-11-19 16:23:30 +01:00
1 parent 38a23e2210
commit 45b1fc04c7
36 files changed
+9594 -7892

No files matched your search

+1 -1
View File
@@ -21,7 +21,7 @@ The current bundled `src/admin/openapi.json` declares these operations (among ot
| `GET /api/config/history` · `POST /api/config/history/restore` | Review/restore retained configuration snapshots. |
| `GET /api/status` · `GET /api/backends` | Operational status and backend observations. |
| `GET /api/cache` · `POST /api/cache/purge` · `POST /api/cache/invalidate` | Cache observations and authenticated invalidation. `GET` supports the lightweight `view=live` polling view. |
| `GET /api/cache/rules/stats` · `GET /api/cache/rules/targets` · `POST /api/cache/rules/test` · `POST /api/cache/rules/import-vcl` | Cache rule match counters, the vhosts a rule can target (ordinary and generated Docker vhosts), simulation of saved or draft rules for a test request/response (also for Docker vhosts), and conversion of a VCL subset into rules (nothing is saved). See [Cache rules](CACHE.md#cache-rules-vcl-style). |
| `GET /api/cache/rules/stats` · `GET /api/cache/rules/targets` · `POST /api/cache/rules/test` · `POST /api/cache/rules/import-vcl` | Cache rule match counters, the vhosts a rule can target (ordinary and generated Docker vhosts), simulation of saved or draft rules for a test request/response (also for Docker vhosts), and conversion of a VCL subset into rules (nothing is saved). See [Cache rules](CACHE.md#cache-rules-vcl-style) and the [supported VCL import matrix](VCL.md). |
| `GET /api/transform` | Transform observations and resource usage. Supports the lightweight `view=live` polling view. |
| `GET /api/logs` · `GET /api/live-logs` | Recent and streaming request logs. |
| `GET /api/file-logs` · `GET /api/file-logs/query` | Stored-log exploration. |
+46 -10
View File
@@ -37,14 +37,45 @@ Set **Default grace (seconds)** in Settings → Cache (default **60**, range 0..
| Client `only-if-cached` | **Fresh/stale eligible HIT**, or **504** if no reusable representation; never fetch origin on MISS | Same |
| Client `min-fresh`, `max-stale`, positive `max-age` | Keep constraints; an otherwise fresh object can be rejected by `min-fresh`, while eligible stale entries can be served by `max-stale` | Same |
| Origin `no-cache` with `ETag`/`Last-Modified`, fallback TTL = `0` | Store for **conditional revalidation** (`304`) but never fresh-HIT without checking origin | Same |
| Origin **`public, no-cache`** and explicit fallback TTL `> 0` | Treat the administrator's configured **Fallback TTL for public responses** as shared freshness (capped by max TTL), even when the origin has no validator; this explicitly overrides origin `no-cache` | Validator-only revalidation, no override |
| Origin `no-cache` (with or without `public`) and explicit fallback TTL `> 0` | Treat the administrator's configured fallback TTL as shared freshness (capped by max TTL), even when the origin has no validator; this explicitly overrides origin `no-cache` | Validator-only revalidation, no override |
| Origin `max-age=0` / already expired, with `stale-if-error`, a validator or client `max-stale` | Retain the expired representation; it does not become a fresh HIT. Can serve stale on an eligible error, revalidate, or honor explicit client allowance | Same |
| Origin `Surrogate-Control: no-store` | Do not store, even when a fallback TTL is configured; this is an additional compatibility-mode safeguard | Legacy response policy |
| Origin `private`, `no-store`, `Set-Cookie`, invalid `Vary` | Must not enter shared cache; configured static-cookie exceptions do not override response privacy | Same |
| Eligible cached object after TTL | Implicit background-refresh grace up to **60 seconds by default** (configurable with `cache.varnish_grace_seconds`, `0` disables it) **only** for entries initially fresh with **no** origin `stale-while-revalidate` directive; explicit `stale-while-revalidate=0` disables implicit grace. Existing `must-revalidate` / `proxy-revalidate` restrictions still apply | No implicit grace |
| Cookies, Authorization, `Vary`, per-vhost exclusions/force, query/range restrictions, BAN/PURGE, request collapse, transforms, compression, HOT/COLD | Existing RustProxy mechanisms remain in effect | Same |
| Cookie requests | Bypass by default; an explicit cache `lookup` action (imported from VCL `return(hash)`) can allow a GET/HEAD with Cookie to reach cache. A matching `pass` rule wins, and retained Cookie values always partition the cache variant. | Cookie requests bypass without this VCL exception |
| Authorization, `Vary`, per-vhost exclusions/force, query/range restrictions, BAN/PURGE, request collapse, transforms, compression, HOT/COLD | Existing RustProxy mechanisms remain in effect | Same |
**Important:** using a positive fallback TTL to reuse an origin response marked `public, no-cache` is an **explicit administrative freshness override**. It can serve outdated content for that duration; leave fallback TTL at `0` if the backend's `no-cache` must always be honored. The fallback override applies only to responses carrying `public`, not to private/no-store/Set-Cookie responses or `Surrogate-Control: no-store`. The configured `max_ttl_seconds` still caps remaining freshness. Without fallback TTL, origin `no-cache` still requires an origin validator to be stored. An origin `max-age=0` is never made fresh merely because `stale-if-error` is present.
**Important:** in compatibility mode, a positive fallback TTL overrides an origin response's `no-cache` **even without `public`**. This is an explicit administrative freshness override, not Varnish's built-in handling of `no-cache` (which normally does not cache it), nor strict RFC 9111 behavior. It can serve outdated content for that duration; leave fallback TTL at `0` if the backend's `no-cache` must always be honored. Privacy barriers (`private`, `no-store`, `Set-Cookie`, `Surrogate-Control: no-store`) still apply. The configured `max_ttl_seconds` caps freshness. With fallback TTL 0, origin `no-cache` needs an origin validator to be stored for revalidation. An origin `max-age=0` is never made fresh merely because `stale-if-error` is present.
### VCL ordering and supported backend header overrides
Imported VCL is compiled into the **same rule engine** as the global and per-Vhost graphical rules. The editor discards in-flight import results if its source is changed or the importer is closed, so cancelled conversions cannot silently add obsolete rules. The import endpoint returns `warnings` for unsupported Varnish operations; do not deploy an imported rule set until those warnings are reviewed. RustProxy is not an arbitrary VCL interpreter, and `pipe`, `restart`, `purge`, `synth`, dynamic VCL expressions and custom subroutines are not equivalent to Varnish.
- `vcl_recv` runs before `vcl_hash` (the latter runs after `return(hash)`). `return(pass)` stops normal request rules. Terminal `return(deliver)` stops the relevant response/deliver stage. Supported request rewrites also reach the origin on cache-disabled routes; such routes still cannot store or serve from cache.
- `if`/`elsif`/`else`, nested guards, supported `&&`/`||`/`!` expressions and request-cookie/query edits preserve order. Later matching conditions see supported earlier mutations.
- `vcl_backend_response` supports `set/unset beresp.http.Header` for **constant valid headers**, as well as TTL, grace and uncacheable controls. Backend header changes affect both admission policy and the response delivered to the client (also on BYPASS). Hop-by-hop, `Set-Cookie`, length, Host and other protected fields cannot be assigned by general header actions; use the dedicated Set-Cookie removal action.
- `vcl_deliver` supports constant `set/unset resp.http.Header` and `return(deliver)`; graphical `default_header` provides set-if-missing. Ordered operations are reflected in evaluation and delivery.
- Per-Vhost rules are evaluated before applicable global rules. A vhost edit to a request cookie/query rewrite, response/deliver header, or request routing aspect wins over a conflicting global edit. In the same scope, later writes supersede earlier ones unless a matching rule has `stop=true` or terminal `return`.
- Credential separation remains mandatory for shared caching. `return(hash)` on a request carrying `Cookie` partitions RustProxy's cache variant by the **complete remaining Cookie**, and includes `Vary: Cookie` for downstream caches. Session cookies must be intercepted by an earlier `return(pass)` rule. Authorization never becomes shareable through this exception.
### Complete VCL support and `Vary`/header overrides
See [VCL compatibility and header overrides](VCL.md) for a statement-by-statement compatibility matrix, global/per-Vhost priority, stage timing, exact `set`/`unset` support, `Vary` behavior and protected headers. **`beresp.http.Vary` affects cache variants; `resp.http.Vary` only affects the outgoing header.** Unsetting either can break downstream cache correctness. `set/unset beresp.http.Cache-Control` changes cache admission policy, while deliver-stage header edits do not. A deliberately rewritten `private`/`no-store` header or removed `Set-Cookie` no longer protects the representation, so use these actions only for public content.
### Explicit Cookie lookup with imported VCL
Varnish defaults to `pass` on `Cookie`, but custom `return(hash)` can opt in. RustProxy's VCL importer supports this explicit opt-in in `varnish_compatible` mode only. Use an early `pass` rule for session cookies, followed by `return(hash)` for eligible requests:
```vcl
sub vcl_recv {
if (req.http.Cookie ~ "(^|; *)[sS][eE][sS][sS][iI][oO][nN][iI][dD]=") {
return (pass);
}
return (hash);
}
```
The VCL importer supports a subset of VCL, not full Varnish runtime semantics. Imported `return(hash)` becomes a `lookup` request action. When Cookie remains on a request, RustProxy matches cache entries on that Cookie (not only the default URL key), avoiding accidental cross-user reuse; remove irrelevant tracking cookies first to improve HIT rate. `Authorization`, non-GET/HEAD methods, request `no-store`, access checks, private/no-store response headers and backend `Set-Cookie` are not overridden by this action. With compatibility disabled, the `lookup` action does not override Cookie BYPASS.
This is **a Varnish-inspired policy subset, not full Varnish binary/VCL compatibility**. RustProxy deliberately keeps an explicit zero-by-default fallback TTL instead of Varnish's implicit 120-second default, retains client controls beyond hard reload, enforces multi-tenant and cookie/Authorization safety rules, and does not implement hit-for-miss/hit-for-pass markers. The current compatibility-specific `Surrogate-Control` safeguard handles `no-store`; it does **not** interpret every Surrogate-Control extension or use Surrogate-Control `max-age` as a TTL override. Different VCL configurations can behave differently.
@@ -69,18 +100,19 @@ In **Vhosts → Cache**, overrides for static extensions, bypass path prefixes a
| Stage | VCL equivalent | Conditions | Actions |
|---|---|---|---|
| Request | `vcl_recv`, `vcl_hash` | host, URL, path, extension, method, query parameter, request header, cookie, client IP | bypass cache (`pass`), remove cookies (all or all except listed), remove query parameters (list with `*`, or keep only listed), add a header or cookie value to the cache key |
| Backend response | `vcl_backend_response` | the request conditions plus status (`200`, `4xx`, `500-599`), Content-Type, response header | set TTL, set grace, do not store, ignore backend `Cache-Control`/`Expires`, remove `Set-Cookie` |
| Request | `vcl_recv`, `vcl_hash` | host, URL, path, extension, method, query parameter, request header, cookie, client IP | bypass cache (`pass`), explicit lookup (`hash`), remove cookies (all or all except listed), remove query parameters (list with `*`, or keep only listed), set/remove **safe request headers**, add a header or cookie value to the cache key |
| Backend response | `vcl_backend_response` | the request conditions plus status (`200`, `4xx`, `500-599`), Content-Type, response header | set TTL, set grace, do not store or **undo a rule-imposed do-not-store**, ignore backend `Cache-Control`/`Expires`, remove `Set-Cookie`, set/remove permitted backend response headers |
| Deliver | `vcl_deliver` | the request and response conditions | set a response header, set it only if the response lacks it, or remove it |
- Rules run top to bottom (drag to reorder). Each rule matches when all (or any) of its conditions match; a rule without conditions matches every request. *Stop evaluating later rules* ends the stage, like `return` in VCL.
- Vhost rules run before global rules. A global rule can be limited to selected vhosts. For TTL, grace, bypass and *do not store*, the first matching rule wins: the vhost editor and the global list show which rules override others, and the tester lists every overridden action. *Ignore global cache rules* switches global rules off for that vhost.
- Request rules change the request like VCL does: removed cookies and query parameters are also not sent to the backend. Values added to the cache key create separate variants (for example one per `lang` cookie).
- Vhost rules run before applicable global rules. A matching vhost assignment to request routing/cookie stripping/query stripping, TTL or grace overrides the same aspect in a global rule. Within the same scope later matching assignments win unless a terminal rule stops evaluation. Response and delivered header edits have per-header ownership; `stop` and imported VCL `return(...)` stop the current stage. The tester shows suppressed scalar overrides. *Ignore global cache rules* switches global rules off for that vhost.
- Request rules change the request like VCL does: removed cookies, query parameters and safe selected request headers also affect the backend. Request-header edits are visible to subsequent rules and hashing; authorization, identity, transport and request cache policy fields are protected. Values added to the cache key create separate variants (for example one per `lang` cookie).
- Safeguards stay in place: only GET/HEAD without a body are cached, `Authorization`, Basic Auth, login providers and sticky sessions still bypass the cache, and a response with `Set-Cookie` is never stored unless a rule removes it. *Ignore backend Cache-Control* keeps the original header for the browser; it only changes what RustProxy stores.
- **Test a request** checks the rules on screen (including unsaved edits) against a sample URL, headers, client IP and backend response, and shows the decision, cache key, TTL/grace, matched and overridden rules. **Import VCL** converts supported statements from `vcl_recv`, `vcl_hash`, `vcl_backend_response`/`vcl_fetch` and `vcl_deliver` (`if`/`elsif`/`else`, `~`, `!~`, `==`, `!=`, status comparisons, `return (pass)`, `unset req.http.Cookie`, query-parameter `regsuball` on `req.url`, `hash_data(req.http.X)`, `beresp.ttl`, `beresp.grace`, `beresp.uncacheable`, `unset beresp.http.Set-Cookie`, `set/unset resp.http.X`); everything else is listed as a warning. **Copy as VCL** shows the equivalent VCL (read-only).
- For the exact import syntax, warnings, `Vary` mutation semantics and header restrictions see [VCL compatibility](VCL.md).
- **Test a request** is a compact, responsive two-section tester (HTTP request / example backend response) shared by **Settings → Cache → Rules**, **Vhosts → Cache** and **Docker vhosts → Cache**. It checks rules on screen (including unsaved edits) against a sample URL, headers, client IP and backend response, and shows the decision, cache key, TTL/grace, matched and overridden rules. In global settings it tests unsaved **global** rules plus the selected vhost's *saved* rules/settings. In a vhost or Docker service editor it tests unsaved **local** rules plus the *saved* applicable global rules unless **Ignore global cache rules** is checked. This is a simulated decision, not a real HTTP request or a prediction of HIT after two requests. Other unsaved cache settings, such as the vhost TTL or the global compatibility toggle, are not submitted by the tester. For a path-only local test (e.g. `/product`), the panel supplies the current editor hostname as `Host` if the headers field does not already contain `Host`; a full URL or an explicit `Host` takes precedence. Unsaved/unpublished Docker vhosts may not yet have a saved vhost ID; the test then cannot model every saved per-vhost setting. Check the resulting host/key and rules before trusting the preview. **Import VCL** converts supported statements from `vcl_recv`, `vcl_hash`, `vcl_backend_response`/`vcl_fetch` and `vcl_deliver` (`if`/`elsif`/`else`, `~`, `!~`, `==`, `!=`, status comparisons, `return (pass)`, `unset req.http.Cookie`, safe constant `set/unset req.http.X`, restricted query-parameter `regsuball` on `req.url`, `hash_data(req.http.X)`, `beresp.ttl`, `beresp.grace`, `beresp.uncacheable = true/false`, `unset beresp.http.Set-Cookie`, `set/unset beresp.http.X` (constant values; non-protected headers), `set/unset resp.http.X`, terminal `return(hash)`/`return(lookup)`/`return(pass)`/`return(deliver)`, nested boolean guards); unsupported operations (including arbitrary URL rewrites) produce import warnings rather than guessed actions. **Copy as VCL** is a read-only **approximate preview**, not an exact round-trip or configuration backup. Imports with warnings now require explicit **Add partial import (reviewed)** before converted rules are added to the unsaved editor.
- Limits: 128 rules per list, 16 conditions and 16 actions per rule, regular expressions with linear-time matching. Match counters live in memory (reset on restart) and are exported as `rust_proxy_cache_rule_matches_total{origin,vhost,rule}` when the *Domains and effectiveness* metric group is enabled.
- Rules apply to Reverse Proxy vhosts (including Docker vhosts) while the cache is active for the route; built-in web server sources are not affected.
- **Deliver rules apply to the whole application.** Since 0.37.2 they run for every response of the vhost — also when caching is switched off for it, for bypassed requests and for misses — so they can override headers such as `Cache-Control` for browsers, or add security headers, for an entire application. *Set header if missing* (`default_header`) keeps a header the backend already sent. Templates: *Browser cache for static files (30 days)*, *No browser cache for HTML and /admin*, *Default security headers*. Request and backend-response rules still run only while the cache is active for the route.
- **Deliver rules apply to the whole application.** Since 0.37.2 they run for every response of the vhost — also when caching is switched off for it, for bypassed requests and for misses — so they can override headers such as `Cache-Control` for browsers, or add security headers, for an entire application. *Set header if missing* (`default_header`) keeps a header the backend already sent. Templates: *Browser cache for static files (30 days)*, *No browser cache for HTML and /admin*, *Default security headers*. Supported request rewrites and backend-response header edits can also affect normal reverse-proxy traffic on a cache-disabled route, but they do **not** enable cache storage. See [VCL stages](VCL.md#where-to-import-rule-order-and-activation) for the exact scope.
- Docker vhosts have their own rules too: in **Docker vhosts**, enable *Cache* for the service and open **Cache for this vhost** (default TTL and rules). The global rule vhost picker and the tester list Docker vhosts (marked *Docker*) next to ordinary vhosts; `GET /api/cache/rules/targets` returns the same list.
## Stored object rules
@@ -88,7 +120,7 @@ In **Vhosts → Cache**, overrides for static extensions, bypass path prefixes a
- Reuse is scoped by frontend scheme, Host, exact client URL, Vhost/content policy and eligible `Vary` dimensions. HTTP and HTTPS objects do not cross-share.
- GET and suitable HEAD requests may reuse a full object; changing request methods do not silently invalidate all cached GET results.
- Authorization, dynamic cookies, `Set-Cookie`, sticky-affinity cookies, Tinyauth and other private signals normally cause **BYPASS**. The static-extension exception may ignore `Vary: Cookie` only if the explicitly public response is otherwise safe to store and the global/vhost option is on. It never overrides `private`, `no-store` or `Set-Cookie`; the origin must guarantee that the complete asset response is not session-dependent.
- Origin status, response size, TTL, unsupported metadata, range/conditional semantics and request/client cache directives can prevent fill or require validation.
- Only status **200 OK** responses can be stored in HOT/COLD. A cache-rule `ttl` targeting `404`, `301` or `302` cannot override this storage restriction; the older 404 TTL rule template was removed because it never produced HIT. Other response sizes, TTL, unsupported metadata, range/conditional semantics and request/client cache directives can prevent fill or require validation.
- A Web Service selected as a Vhost source uses the same cache policy for eligible local files. File changes can be checked with `ETag` / `Last-Modified`; a 304 validation may refresh a stored body without downloading it again.
## Freshness and diagnostics
@@ -114,6 +146,10 @@ 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.
### 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).
## Cache response headers and upstream diagnostics
**RFC 9211:** `Cache-Status` is a structured list of cache hops, ordered from the origin-side cache toward the client. RustProxy **does not replace or suppress** an upstream `Cache-Status`. When **Settings → Cache → Expose Cache-Status** is enabled and RustProxy makes a cache decision, it appends its own `RustProxy` member to the existing list; multiple HTTP header fields are an equivalent wire representation of the same list. There is no `backend=hit/miss` parameter: the upstream's own members already describe its cache decisions.
+1 -1
View File
@@ -148,7 +148,7 @@ In **Docker vhosts**, select the service and set:
| **Frontend listeners / certificate** | Selected through the agent defaults: automatic SNI or the agent's certificate list (see [Certificates](#certificates)); the editor shows the certificate that will be used. |
| **Frontend protocols** | HTTP/1.1 is always available. Enable/disable HTTP/2 and HTTP/3 independently per Docker vhost (both enabled by default). H2/H3 require corresponding frontend listener support; switching them does not change the selected HTTP/HTTPS backend scheme. H3 disabled also removes its advertisement. |
| **Force HTTPS / WebSockets** | Enable only when needed and when the right frontend listeners exist. |
| **Cache / compression / transforms** | Optional; obey the global limits and privacy policy of the application. With **Cache** enabled, **Cache for this vhost** sets a default TTL (empty = global default) and the same cache rules editor as an ordinary vhost (templates, VCL import/preview, tester, *Ignore global cache rules*); see [Cache rules](CACHE.md#cache-rules-vcl-style). Stored as `cache_default_ttl_seconds`, `cache_rules` and `cache_ignore_global_rules` on the assignment.
| **Cache / compression / transforms** | Optional; obey the global limits and privacy policy of the application. With **Cache** enabled, **Cache for this vhost** sets a default TTL (empty = global default) and the same cache rules editor as an ordinary vhost (templates, VCL import/preview, compact two-section tester, *Ignore global cache rules*). **Cache & VCL guide** opens the shared modal and inserts examples into this Docker vhost's importer, never the global editor. Tests use unsaved service rules plus saved applicable global rules, unless ignored; a path-only test uses the current service hostname as `Host` when no explicit Host is provided. Unpublished service tests may lack saved vhost settings; see [Cache rules](CACHE.md#cache-rules-vcl-style). Stored as `cache_default_ttl_seconds`, `cache_rules` and `cache_ignore_global_rules` on the assignment.
| **Security and access** | Everything an internet-facing app usually needs, without creating an ordinary vhost: **HTTP Basic Auth** (see below), **HTTP methods** (allow only / block listed, the same method picker as vhosts), **per-client IP rate limit** (requests per window and burst; exceeded requests get `429`), **country access** (block or allow only listed countries via GeoIP; country rules of ACL profiles also apply), **security headers** (HSTS with max-age and includeSubDomains, `X-Content-Type-Options: nosniff`, `X-Frame-Options`, `Referrer-Policy`) and **Use verified Cloudflare client IP** when the app is behind Cloudflare. The summary line of the section shows what is active. Stored as `method_policy`, `rate_limit`, `security_headers` and `cloudflare_client_ip`; unused options are not stored. Docker apps have no login of their own; to require one, publish the app through an ordinary vhost with HTTP Basic Auth, forward auth or OIDC. |
| **Diagnostic headers** | `Server-Timing`, the selected backend (`X-Rust-Proxy-Backend`) and the backend time, for testing; keep them off in production. For Docker publications the backend header uses `<agent-id>/<12-character-service-hash>` (for example `node1/012345abcdef`), rather than the internal `docker-node1-012345abcdef/docker` identifier. Ordinary Vhosts retain their usual backend IDs; the change affects only header presentation, not routing, logs or metrics. Stored as `timing_headers`, `backend_header`, `backend_timing_header`. |
| **Health / ACL / timeouts** | **Access control** shows the agent default ACL profiles pre-selected (*Agent default in use: …*). Unchecking or changing them overrides the default for this service only; leaving them as they are keeps following the agent default. **Public vhost (no agent default ACL)** publishes the service without the agent default profiles (`inherit_acl_profiles: false`) and disables the per-app ACL; global block/allow rules still apply. Up to eight reusable ACL profiles per app; selected profiles appear as removable badges and the summary line shows the effective state. Optional inline ACL remains independently enforced. Explicit denies and country blocks beat merged allows. Test allowed and blocked clients. |
+2 -1
View File
@@ -66,13 +66,14 @@ RustProxy is a single service that combines a reverse proxy, a static/PHP web se
- Shared HTTP cache with a memory tier (HOT) and an optional disk tier (COLD).
- RFC 9111 freshness, validators and `Vary` with conservative header-aware normalization (known comma-list fields, language/encoding/charset qualities and media types), while preserving opaque values and quoted strings; stale-while-revalidate, stale-if-error and request coalescing. Configurable static-extension exception for cookie-independent assets: omit `Vary: Cookie` only for explicitly public cacheable responses, preserving all other Vary dimensions.
- Varnish-compatible policy option, forced caching rules and per-location cache switches.
- Graphical [cache rules](CACHE.md#cache-rules-vcl-style) in the spirit of VCL (bypass, cookies, query parameters, cache-key variants, TTL/grace, headers) per vhost and globally, with a request tester and VCL import.
- Graphical [cache rules](CACHE.md#cache-rules-vcl-style) with global and per-Vhost precedence, terminal VCL pass/hash behavior, ordered safe request-header/cookie/query rewrites, vcl_hash variants, reversible rule-only no-store decisions, backend-response header edits before cache policy, and delivery header overrides; includes a shared, responsive two-section tester in global, ordinary vhost and Docker vhost editors, a scope-aware in-panel VCL guide, and a warning-reporting VCL subset importer. The exact VCL syntax, backend vs deliver `Vary`/header mutations and safety restrictions are listed in [VCL compatibility](VCL.md).
- RFC 9211 `Cache-Status` and optional `X-Cache` diagnostics.
- Purge and ban from the panel, the API or HTTP PURGE/BAN from allowlisted addresses.
- Live compression with gzip, Brotli, Zstandard and deflate.
- Optional minification of JavaScript, CSS, HTML, SVG and JSON with memory budgets.
![Cache](images/cache.png)
- **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).
## Monitoring and logs
+2 -1
View File
@@ -36,7 +36,8 @@ Guides for operating RustProxy: installation, publishing services, security, cer
## Performance and delivery
- [Cache](CACHE.md) — HOT/COLD cache, RFC 9111 `Vary` matching/normalization, safe static-asset cookie exceptions, freshness, `Cache-Status` and invalidation.
- [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 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.
## Operations
+167
View File
@@ -0,0 +1,167 @@
# VCL import: supported instructions and exact effects
This guide describes the VCL **subset implemented by RustProxy 0.38.10**, 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.
## Where to import, rule order and activation
- **Settings -> Cache -> Rules**: global cache rules, optionally targeted to particular vhosts.
- **Vhosts -> Cache -> Cache rules for this vhost**: rules for one vhost (ordinary or Docker-generated). **Ignore global cache rules** disables the global rules for that vhost.
- Imported rules and graphical rules use the same engine. Within each stage, **vhost rules run first**, followed by applicable global rules. A vhost edit to the same header or supported scalar setting wins over a conflicting global edit. In one scope, later matching edits win unless `stop`/`return(...)` terminates the stage.
- A terminal `return(hash)` ends normal `vcl_recv` processing but **does not skip `vcl_hash`**. A terminal `return(pass)` skips lookup and `vcl_hash`. A return/stop does not skip the other, independent response/deliver stages.
- Regular cache admission still requires enabled global/vhost caching, an eligible route, method, request policy and response. A `return(hash)` cannot turn on a disabled cache or override `Authorization`/access controls. Supported request header/cookie/query rewrites and backend header edits can still affect an ordinary reverse-proxy response even when cache storage is disabled; deliver-stage edits apply to the final response on HIT, MISS and BYPASS. These rules do not apply to embedded Web Server sources or RustProxy's administration/control-plane responses.
## Supported VCL statements
| Hook | Recognized VCL syntax | Actual effect and limits |
|---|---|---|
| `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` | `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. |
| `vcl_hash` | `hash_data(req.url);` / `hash_data(req.http.Host);` | Accepted as built-in operations with **no additional rule**: URL/query and normalized Host are already part of the RustProxy key. Other expressions are not imported. `hash_data` in `vcl_recv` is rejected with a warning. |
| `vcl_backend_response` / `vcl_fetch` | `set beresp.ttl = 60s;` and `set beresp.grace = 30s;` | Configures cache freshness/grace, within RustProxy limits and policy. Units: `ms`, `s`, `m`, `h`, `d`, `w`, `y` (rounded to whole seconds). Does not automatically rewrite the browser's `Cache-Control`. |
| `vcl_backend_response` / `vcl_fetch` | `set beresp.uncacheable = true;` / `= false;` | **RustProxy-specific difference:** `true` disables storing; `false` reverses an earlier **rule-imposed** no-store decision. Varnish itself ignores resetting `beresp.uncacheable` from true to false. In RustProxy, `false` does **not** ignore origin `private`, `no-store`, `Set-Cookie` or other cache admission restrictions. A vhost `false` overrides conflicting global `true`. |
| `vcl_backend_response` / `vcl_fetch` | `set beresp.http.X-Name = "literal";` | Replaces the named origin header before cache admission and before delivery. Only a **single quoted constant string** is supported, on an allowed header. |
| `vcl_backend_response` / `vcl_fetch` | `unset beresp.http.X-Name;` | Removes the named origin header before cache admission and delivery. |
| `vcl_backend_response` / `vcl_fetch` | `unset beresp.http.Set-Cookie;` | A **special dedicated action**, which removes the origin's Set-Cookie before cache policy. Only safe for genuinely public responses. |
| `vcl_backend_response` / `vcl_fetch` | `return(pass);`, `return(hit_for_pass);` or `return(uncacheable);` | Marks the response as not storable; **does not** create Varnish hit-for-pass markers. |
| `vcl_backend_response` / `vcl_fetch` | `return(deliver);` | Stops the remaining rules in that response hook. |
| `vcl_deliver` | `set resp.http.X-Name = "literal";` | Sets/replaces the named header **only on the outgoing response**. Does not change the cache's stored object or variant key. |
| `vcl_deliver` | `unset resp.http.X-Name;` | Removes the named header **only from the outgoing response**, including an HIT. |
| `vcl_deliver` | `return(deliver);` | Stops further deliver-stage rules on the matching path. |
For `set` and `unset` header instructions, HTTP header names are case-insensitive. Quoted strings accept `\"` and `\\` escapes; regex escapes such as `\s` and backreferences such as `\1` are kept literally. **Malformed statements with extra operands are warned about and skipped**, rather than silently treating their prefix as a valid action. Unterminated quoted strings and block comments reject the import. Valid headers and values are checked when a rule is compiled. The importer reports unsupported/invalid statements as warnings (skipped) or parsing errors (import rejected), rather than running them as Varnish code. A rejected header edit no longer discards adjacent valid statements, and long supported action blocks are split at the rule action limit. For repeated header fields, `set` replaces the **entire** field (not one value); `unset` removes **all occurrences** of that field. Assigning `""` creates an empty field, which is not the same as removing it. Neither action merges individual comma-separated `Vary` members. The panel also offers graphical-only actions such as **Set header if missing**, **Ignore backend Cache-Control**, cookie allowlists and explicit query-parameter filtering; do not assume those actions have a one-to-one VCL syntax.
### Request header changes: scope and safeguards
```vcl
sub vcl_recv {
if (req.url ~ "^/catalog") {
unset req.http.X-Tracking;
set req.http.X-Device = "mobile";
return(hash);
}
}
sub vcl_hash {
hash_data(req.http.X-Device);
}
```
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 the existing dedicated whole-header `unset`), `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_`.
## Recognized conditions and expressions
| Form | Example | Notes |
|---|---|---|
| URL, method, request headers | `req.url ~ "^/assets/"`, `req.method == "GET"`, `req.http.Cookie` | `req.url` includes path and query; an unqualified request header tests presence. `bereq.url` and `bereq.http.X` are accepted as rule-request aliases. |
| Backend/delivery status and headers | `beresp.status == 200`, `beresp.http.Content-Type ~ "^text/"`, `resp.http.X-Flag` | Evaluated against the response at the relevant stage; earlier supported header mutations are visible to subsequent conditions. |
| Comparisons | `==`, `!=`, `~`, `!~` | Equality and regex matching for supported request/response variables. |
| Status comparisons | `beresp.status >= 500`, `resp.status < 400` | Also accepts `>`, `<=`, `==`, `!=`. |
| Branching | `if`, `elsif`, `else`, nested blocks, `&&`, `||`, `!`, parentheses | Branch guards are preserved in the generated rules, subject to the rule/condition limits. |
`client.ip` with a Varnish ACL is **not imported**; the graphical rules have a client IP/CIDR condition instead. `include`, external modules, backend/ACL/probe definitions and custom subroutines are not loaded as executable configuration. Arbitrary functions, variables, string concatenation, dynamic header expressions, `pipe`, `restart`, `purge`, `synth` and hit-for-miss/hit-for-pass behavior are **not** implemented. Import is a conversion, not a promise of runtime Varnish equivalence.
Limits include a maximum VCL source of 256 KiB; the compiled cache-rule lists are limited to 128 rules, 16 conditions and 16 actions per rule. A complex boolean expression may expand to too many rules and be skipped with a warning. Use the graphical tester to verify the imported behavior.
## `Vary`: before or after the cache?
`Vary` is an **allowed** header for both backend (`beresp`) and deliver (`resp`) actions. The phase matters:
| VCL statement | Internal cache / stored variants | Response sent to clients and downstream proxies |
|---|---|---|
| `set beresp.http.Vary = "Accept-Language";` | Replaces the origin's complete `Vary` field before the variant plan is built. Distinct `Accept-Language` requests can have separate stored variants. | Sends the replaced `Vary`, unless later processing or deliver rules modify it. |
| `unset beresp.http.Vary;` | Drops origin-specified variant dimensions **before storage**. A response that actually depends on a removed dimension may be reused for the wrong client. | Removes the origin field unless safety handling re-adds `Vary: Cookie`/`Authorization` or later rules set it. |
| `set resp.http.Vary = "Accept-Language";` | **No change** to the variant dimensions already computed/stored. | Replaces the final `Vary`; may incorrectly describe the cache key to a CDN. |
| `unset resp.http.Vary;` | **No change** to internal variants or HIT behavior. | Removes `Vary` downstream. Dangerous when the response varies by language, encoding, cookies or credentials. |
Important details:
- `set beresp.http.Vary = "X-Device";` **replaces**, not appends: any previous `Vary: Accept-Encoding` or `Vary: Cookie` is discarded by that assignment. The importer does **not** support expressions such as `beresp.http.Vary + ", X-Device"` or `regsub(beresp.http.Vary, ...)` to merge values. List all required dimensions explicitly in a constant string, or configure them at the origin.
- `Vary: *` and malformed `Vary` prevent shared reuse. With a valid `Vary`, RustProxy uses **all retained** dimensions and normalizes selected header families as described in [Cache](CACHE.md#vary-matching-rfc-9111-41).
- **Safety exception:** when a request carrying `Cookie` is explicitly allowed by `return(hash)` (or forced caching), RustProxy makes its variant cookie-dependent and can **re-add `Vary: Cookie`** before storage/delivery even if `beresp.http.Vary` removed it. Forced credential variants can likewise add `Vary: Authorization`. This is not a general VCL override of protected request policies.
- **Static-file exception:** `Ignore Vary: Cookie for public static assets` may remove just the `Cookie` member from `Vary` only under the documented static extension, explicit `public`, freshness and privacy checks. It does not erase other dimensions. The static-cookie options are separate from manually setting/unsetting `Vary` in VCL.
- `vcl_deliver` runs **after** variant selection. Although `unset resp.http.Vary` is accepted, using it on a variant response can make a browser/CDN store an unsafe representation. Do not remove `Vary` only to increase the HIT ratio.
Example for a response that **really varies only by language**:
```vcl
sub vcl_backend_response {
if (bereq.url ~ "^/catalog") {
set beresp.http.Vary = "Accept-Language";
set beresp.http.Cache-Control = "public, max-age=60";
unset beresp.http.X-Powered-By;
}
}
```
This does **not** claim that all catalog responses are safe to share: the application must not vary them by sessions, cookies, compression, permissions or other request headers unless those dimensions are also retained. If compression can change representation bytes, preserve the corresponding `Accept-Encoding` semantics.
## Removing headers, `Cache-Control` and `Set-Cookie`
| Example | When removed/changed | Does it affect cache admission? |
|---|---|---|
| `unset beresp.http.X-Debug;` | On origin response, before storage and client delivery | Only indirectly, e.g. via metadata/policy if applicable |
| `unset resp.http.X-Debug;` | On final response (HIT/MISS/BYPASS) | **No** |
| `unset beresp.http.Cache-Control;` | Removes origin cache policy before storage | **Yes:** can remove `no-cache`, `private` or `no-store` constraints |
| `set beresp.http.Cache-Control = "public, max-age=60";` | Replaces origin policy before storage | **Yes:** origin policy is evaluated as rewritten |
| `set resp.http.Cache-Control = "public, max-age=60";` | Changes the client-facing header only | **No:** cannot make a BYPASS into a stored HIT |
| `unset beresp.http.Set-Cookie;` | Removes Set-Cookie via special backend rule | **Yes:** removes a reason to reject shared storage |
**Security:** rewriting or removing `Cache-Control: private`/`no-store` in `vcl_backend_response`, or stripping `Set-Cookie`, **explicitly discards the origin's protection**. RustProxy's storage policy sees the rewritten response. Only do this for representations proven identical for all users; never for login, account or session-dependent pages. The graphical **Ignore backend Cache-Control** action can likewise override origin privacy directives for RustProxy cache admission even while preserving them in downstream headers; it must be treated as an explicit policy override. Merely enabling Varnish compatibility does *not* strip these directives. `set beresp.ttl` does not by itself erase `private` or `no-store`.
The following headers are **protected against general `set`/`unset` actions** in both `beresp.http.*` and `resp.http.*`: `Connection`, `Content-Length`, `Content-Encoding`, `Content-Range`, `Date`, `Keep-Alive`, `Proxy-Authenticate`, `Proxy-Authorization`, `Set-Cookie`, `TE`, `Trailer`, `Transfer-Encoding`, `Upgrade`, `Host`, `Alt-Svc`. An attempted edit is skipped with a warning. The one exception is the **dedicated** `unset beresp.http.Set-Cookie` removal action; arbitrary `set beresp.http.Set-Cookie` and `unset resp.http.Set-Cookie` are not supported. Other proxy subsystems may also generate or normalize response headers after backend rules have run.
Example for final-response-only cleanup (does not affect cache identity, TTL or origin storage):
```vcl
sub vcl_deliver {
unset resp.http.X-Debug;
set resp.http.X-Policy-Name = "catalog-public";
return(deliver);
}
```
## Cookies and `return(hash)`
In compatibility mode (`cache.varnish_compatible=true`), `return(hash)` can opt in to caching eligible GET/HEAD requests with Cookie. **It does not remove the Cookie header.** Remaining cookie values partition the RustProxy variant, and the response includes a Cookie `Vary` dimension for downstream caches. This is safer than sharing all cookie-bearing requests, but reduces HIT rates. Explicit `return(pass)` should intercept session cookies **before** `return(hash)`:
```vcl
sub vcl_recv {
if (req.http.Cookie ~ "(^|; *)session=") {
return(pass);
}
if (req.url ~ "^/catalog") {
return(hash);
}
return(pass);
}
```
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.
## `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.38.10.** 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
1. Import VCL in the appropriate global or per-vhost Rules editor. With warnings the importer **does not add the converted rules automatically**. Read each warning; either revise the VCL and rerun or explicitly click **Add partial import (reviewed)**. No VCL is executed directly at runtime. The resulting rules are still unsaved until you save the settings. Closing the importer or modifying its source invalidates any outstanding parse result; an older API response cannot add rules after cancellation. Do not treat **Copy as VCL** as a backup/round trip; use RustProxy configuration exports for exact rules.
2. Expand **Test a request** (two compact sections: HTTP request and backend response) in the global, ordinary-vhost or Docker-vhost Rules editor. Supply URL or path, method, Cookie/other request headers, client IP, example backend status and headers (`Cache-Control`, `Vary`, `Set-Cookie`); inspect matched/suppressed rules, backend header edits, cacheability, TTL/grace and deliver actions. The global tester previews unsaved global rules with the selected vhost's saved rules; a local tester previews unsaved vhost rules with saved applicable global rules, unless **Ignore global cache rules** is enabled. For a path-only test the current local hostname is sent as `Host` if no explicit Host header was provided; full URLs and explicit Host headers win. The tester does **not** simulate other unsaved cache settings and does **not** send a request to the backend. A not-yet-saved vhost may lack its saved settings in the preview. Use real HTTP requests for final HIT/MISS verification.
3. Save the rules, then send the same `GET` twice (and change one `Vary` dimension) against a real reverse-proxy vhost. Inspect `X-Cache` / `X-Cache-Reason` or `Server-Timing`, depending on enabled diagnostics, plus the **actual delivered headers**. A response can be a MISS yet remain ineligible for storage.
4. Test session cookies, `Authorization`, privacy directives, compressed variants, HIT versus BYPASS and global versus per-vhost conflicts before production. If the origin's behavior differs by a header, verify the correct `Vary` is present in both the internal storage decision and the downstream response.
Optional front-end smoke tests (with Python Playwright and Chromium installed): `python3 tests/browser/cache_rules_import_smoke.py` and `python3 tests/browser/cache_rules_tester_smoke.py` from the project root. It exercises the **standalone browser editor** with mocked API responses, including global/per-vhost import and cancellation races; it does **not** replace real Rust integration tests for cache correctness.
See [HTTP cache](CACHE.md), [Cache API](API.md), and [Security](SECURITY.md) for cache settings and operational limits.
+6
View File
@@ -13,6 +13,12 @@ A **Vhost** publishes one or more hostnames on named HTTP/HTTPS listeners. Its s
A Vhost may bind several frontends. Hostnames and selected listeners must match: the existence of a certificate or an upstream does not create DNS entries or a listening socket. Existing Vhosts retain their bindings when new listeners are created.
## Cache rules: tester and VCL guide
In **Vhosts → Edit → Cache**, use the same compact **Test a request** form as in global Cache settings and Docker vhosts. The request and example backend response have separate groups. Tests preview the **unsaved local rules** with the **saved global rules** for that vhost (or exclude them if **Ignore global cache rules** is checked). For a path-only URL the current hostname field is used as the `Host` header, unless you specify `Host` explicitly. This simulates rule decisions without contacting the backend and does not model other unsaved cache settings.
Use **Cache & VCL guide** next to the local rule editor to open the shared instructional modal; **Insert into VCL importer** targets **this vhost**, not global rules. Review import warnings, verify rule priority and save the vhost to activate changes. See [Cache rules](CACHE.md#cache-rules-vcl-style) and [VCL reference](VCL.md).
## Live request-rate graph
Each Vhost card has a **Lifetime request rate** chart showing sampled requests per second since the current browser session began observing that Vhost. The Y-axis automatically follows recent traffic (85th percentile of up to 24 newest displayed samples, with 25% headroom). One anomalous surge no longer compresses normal traffic into a flat line. After sustained changes in request load, the range adjusts up or down automatically.