This commit is contained in:
Mateusz Gruszczyński committed 2026-11-19 23:17:19 +01:00
1 parent 45b1fc04c7
commit 8b7f5dbfb8
21 files changed
+765 -413

No files matched your search

+2 -4
View File
@@ -1,6 +1,6 @@
# 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.
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.
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.
@@ -152,7 +152,7 @@ Use `unset req.http.Cookie;` only when the origin does not need **any** cookies
- `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.
- **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.
- 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
@@ -162,6 +162,4 @@ Use `unset req.http.Cookie;` only when the origin does not need **any** cookies
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.