diff --git a/AGENTS.md b/AGENTS.md
index 053652a..b59345f 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -1,6 +1,6 @@
# RustProxy source and documentation maintenance
-Current source version: **0.38.1**. The Cargo package and binary are named `rust-proxy`.
+Current source version: **0.38.2**. The Cargo package and binary are named `rust-proxy`.
Before editing, read [README.md](README.md), the relevant [documentation guide](docs/README.md) and the actual code and tests. Historical release experiments are not current specifications. Use the bundled `src/admin/openapi.json` for API routes and payloads; the source implementation is authoritative for runtime behavior.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index aea23f1..0604347 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,13 @@
Release history focused on **features, settings, default behavior, compatibility and fixes**. Changes to internal code structure and preliminary performance experiments are intentionally omitted. Historical descriptions reflect their respective releases; consult the current documentation for the settings available in the latest release.
+## 0.38.2 — Server-Timing, STALE and REVALIDATED
+
+- **Server-Timing is appended, not replaced:** on a MISS or BYPASS the origin's own `Server-Timing` metrics (`db;dur=…`, `app;dur=…`) now reach the client, with RustProxy's field after them; before, RustProxy removed them. Several RustProxy hops each append their own field. On a response served from the cache the stored origin metrics are removed, also when timing headers are off, because they described the request that filled the cache.
+- **Metric names for a reverse proxy:** `proxy;dur`, `upstream;dur` and `proxy-cache;desc` (before: `proxy`, `origin`, `cache`). They no longer collide with a CDN in front of RustProxy (`origin` there means RustProxy) or with an application's own `cache` metric. The vhost option `timing_header_names` (panel: **Server-Timing metric names**) also offers `cdn` (`edge`, `origin`, `cdn-cache`, the Akamai mPulse names, for RustProxy as the outermost layer) and `legacy` (the previous names).
+- **Timing-Allow-Origin:** new vhost option `timing_allow_origin` (origins or `*`) lets scripts on other origins, such as a RUM collector or an assets domain, read Server-Timing.
+- **STALE and REVALIDATED:** responses served from cache past freshness (grace, stale-while-revalidate, max-stale, stale-if-error, collapse timeout) and cached objects confirmed by the origin with 304 are now told apart from plain hits. The Server-Timing cache metric and the access-log `cache` field (log filter, `rust-proxy logs`, `/api/logs?cache=`) report `STALE` / `REVALIDATED` instead of `HIT`. `X-Cache` does so with the new option **X-Cache shows STALE and REVALIDATED instead of HIT** (`cache.expose_detailed_status`, global and per vhost, off by default). The Cache dashboard counts them as HIT for the hit ratio and shows them on the request line; `/api/cache` has `stale` and `revalidated` per domain. See [Cache](docs/CACHE.md#detailed-cache-status-stale-and-revalidated).
+
## 0.38.1 — built-in dashboard presets and matching fixes
- **Path prefixes with a trailing slash:** a cache bypass prefix or forced-cache target written as `/api/` now also matches the paths below it (`/api/health`); before, it matched only the exact path `/api/`, so such responses were cached when their headers allowed it. `/api` (without the slash) already covered `/api` and `/api/…` and still does not match `/apix`.
diff --git a/Cargo.lock b/Cargo.lock
index 1b0ef3f..e5f6cbe 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1943,7 +1943,7 @@ dependencies = [
[[package]]
name = "rust-proxy"
-version = "0.38.1"
+version = "0.38.2"
dependencies = [
"anyhow",
"arc-swap",
diff --git a/Cargo.toml b/Cargo.toml
index a45de41..c15b5c0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "rust-proxy"
-version = "0.38.1"
+version = "0.38.2"
edition = "2021"
rust-version = "1.99.1"
description = "RustProxy - independent reverse proxy with local administration"
diff --git a/docker-agent/model.go b/docker-agent/model.go
index 9977bfa..fbd4c8b 100644
--- a/docker-agent/model.go
+++ b/docker-agent/model.go
@@ -1,6 +1,6 @@
package main
-var version = "0.38.1" // overridden by the package builder using -ldflags -X main.version
+var version = "0.38.2" // overridden by the package builder using -ldflags -X main.version
type config struct {
Listen string
diff --git a/docs/CACHE.md b/docs/CACHE.md
index a8b9d26..61d088f 100644
--- a/docs/CACHE.md
+++ b/docs/CACHE.md
@@ -141,6 +141,52 @@ done
The initial request can show `RustProxy; fwd=miss`; an eligible repeat should show `RustProxy; hit; ttl=...`. If the origin sends no `Cache-Status`, there is no upstream member to display. If RustProxy diagnostic output is off, any visible `Cache-Status` is from upstream; absence of a RustProxy member is expected. The actual cache outcome should also be checked in server request logs.
+## Detailed cache status: STALE and REVALIDATED
+
+Two kinds of responses come from the cache but are not plain hits:
+
+- **STALE** — served past its freshness: Varnish grace, `stale-while-revalidate`, `max-stale`, `stale-if-error` while the origin fails, or a request-collapse timeout.
+- **REVALIDATED** — the stored object was confirmed by the origin with `304 Not Modified`.
+
+Where they show:
+
+| Place | Value |
+|---|---|
+| `Server-Timing` cache metric | always `STALE` / `REVALIDATED` |
+| access log `cache` field, log filter and `rust-proxy logs` | always `STALE` / `REVALIDATED` (before 0.38.2: `HIT`); `cache_reason` gives the exact cause |
+| `X-Cache` | `HIT` by default; `STALE` / `REVALIDATED` with **X-Cache shows STALE and REVALIDATED instead of HIT** (`cache.expose_detailed_status`, also per vhost) |
+| Cache dashboard | counted as HIT for the hit ratio; the request line adds `· N STALE · N REVALIDATED` (also `stale` and `revalidated` per domain in `/api/cache`) |
+
+A growing STALE count while the origin is down means RustProxy is answering from cache instead of returning errors. `Only on HIT` treats STALE and REVALIDATED as hits. `X-Cache` stays `HIT` by default because monitoring scripts often match on it.
+
+## Server-Timing
+
+With **Expose Server-Timing diagnostics** (`timing_headers: true` on the vhost) RustProxy adds one `Server-Timing` field. Browsers show it in the developer tools (Network → Timing) and RUM tools read it through `PerformanceServerTiming`.
+
+```http
+Server-Timing: app;dur=7
+Server-Timing: proxy;dur=2.31, upstream;dur=1.94, proxy-cache;desc="MISS"
+```
+
+| Metric | Meaning |
+|---|---|
+| `proxy;dur` | Total time in RustProxy until the response headers, in milliseconds. |
+| `upstream;dur` | Time from sending the request to the backend until its response headers. Absent when the backend was not contacted. |
+| `proxy-cache;desc` | `HIT`, `MISS`, `BYPASS`, `STALE` or `REVALIDATED` (see above). Absent when no cache decision was made. |
+
+**Metric names** (`timing_header_names`, panel: **Server-Timing metric names**):
+
+| Value | Names | When |
+|---|---|---|
+| `standard` (default) | `proxy`, `upstream`, `proxy-cache` | RustProxy as a reverse proxy or load balancer in front of the application. The names do not collide with a CDN in front of RustProxy (Cloudflare, Akamai, Fastly add their own `edge`, `origin`, `cdn-cache`, where *origin* means RustProxy) nor with an application's own `cache` metric. |
+| `cdn` | `edge`, `origin`, `cdn-cache` | RustProxy is the outermost, CDN-like layer and a RUM tool expects the Akamai mPulse names. Do not use with a CDN in front of RustProxy. |
+| `legacy` | `proxy`, `origin`, `cache` | Names used before 0.38.2, for existing dashboards. |
+
+- On a MISS or BYPASS the origin's own `Server-Timing` metrics are kept and RustProxy's field is appended after them. With several RustProxy hops (edge → front → application) every hop appends its own field, so the inner hop's cache result stays visible.
+- On a response served from the cache (`HIT`, `STALE`, `REVALIDATED`) the stored `Server-Timing` of the origin is removed, because it describes the request that filled the cache, not this one. This also applies when `timing_headers` is off.
+- Scripts on the same origin can always read `Server-Timing`. For scripts on another origin (a RUM collector, an assets domain) list those origins in **Timing-Allow-Origin** (`timing_allow_origin: ["https://app.example.com"]`, or `["*"]`); the header is only sent together with Server-Timing.
+- Turn Server-Timing off on public production sites if response timings should not be exposed.
+
## Advanced behavior
- **Budget limits:** HOT RAM capacity, object count/size, transient fill memory and optional COLD byte/object limits. Configure based on real workload and monitor disk/RSS.
diff --git a/docs/HEADLESS.md b/docs/HEADLESS.md
index 5593e3d..5572a3c 100644
--- a/docs/HEADLESS.md
+++ b/docs/HEADLESS.md
@@ -196,7 +196,7 @@ In a container, mount the file read-only (RustProxy never writes it) and keep `/
`GET /healthz` on `--health-listen` answers `200` while every vhost with backends has at least one healthy backend and `503` otherwise:
```json
-{"status":"ok","mode":"headless","version":"0.38.1","revision":4,"uptime_seconds":120,
+{"status":"ok","mode":"headless","version":"0.38.2","revision":4,"uptime_seconds":120,
"last_reload":{"ok":true,"at_unix":1794743660,"error":null},
"vhosts_without_healthy_backends":[],
"pools":[{"vhost":"app","healthy":3,"backends":3}]}
diff --git a/integrations/routeros-oci-build/README.md b/integrations/routeros-oci-build/README.md
index 2f5f34e..24b7886 100644
--- a/integrations/routeros-oci-build/README.md
+++ b/integrations/routeros-oci-build/README.md
@@ -77,10 +77,10 @@ ENV_FILE=integrations/routeros-oci-build/.env \
bash integrations/routeros-oci-build/build-routeros-oci.sh push
```
-For example, with RustProxy version `0.38.1` and the defaults this publishes:
+For example, with RustProxy version `0.38.2` and the defaults this publishes:
```text
-oci.example.net/network/rustproxy:0.38.1
+oci.example.net/network/rustproxy:0.38.2
oci.example.net/network/rustproxy:latest
oci.example.net/network/rustproxy:routeros
```
diff --git a/langs/en_US.json b/langs/en_US.json
index 4c9a9e6..fbebe31 100644
--- a/langs/en_US.json
+++ b/langs/en_US.json
@@ -980,6 +980,11 @@
"vhHttp3Enabled": "Enable HTTP/3 for this vhost",
"vhCloudflareClientIp": "Use verified Cloudflare client IP",
"vhTimingHeaders": "Expose Server-Timing diagnostics",
+ "vhTimingHeaderNames": "Server-Timing metric names",
+ "vhTimingHeaderNamesStandard": "Reverse proxy (proxy, upstream, proxy-cache)",
+ "vhTimingHeaderNamesCdn": "CDN edge (edge, origin, cdn-cache)",
+ "vhTimingHeaderNamesLegacy": "Before 0.38.2 (proxy, origin, cache)",
+ "vhTimingAllowOrigin": "Timing-Allow-Origin (origins that may read the timings, or *)",
"vhRateEnabled": "Enable per-client IP rate limit",
"vhRateRequests": "Requests per window",
"vhRateWindow": "Window (seconds)",
@@ -1525,7 +1530,7 @@
"vhBackendDiagnostics": "Backend diagnostics",
"vhBackendHeader": "Expose selected backend (X-RustProxy-Backend)",
"vhBackendTimingHeader": "Expose backend response time (X-RustProxy-Backend-Time)",
- "vhBackendDiagnosticsHelp": "Opt-in response headers. Backend time measures origin request-to-response-headers latency; responses served without contacting an origin do not report a backend.",
+ "vhBackendDiagnosticsHelp": "Opt-in response headers. Server-Timing is appended to the origin's own metrics; cached responses replace it. Backend time measures origin request-to-response-headers latency; responses served without contacting an origin do not report a backend.",
"authModeHelp": "Select an identity provider and a supported integration method. Forward Auth checks sessions via the provider; OIDC uses central login with a callback on the protected application. Existing Vhost integrations remain supported.",
"taAdvanced": "Advanced Tinyauth settings",
"notfound": "404 hosts",
@@ -2603,6 +2608,7 @@
"backendHealthOverride": "Custom health check for this backend",
"backendHealthOverridesHelp": "When unchecked, inherit the vhost health policy. Disabling monitoring keeps the backend available for explicitly pinned locations, without active probes or passive ejection. Use a custom check for an individual backend.",
"cacheOnlyHits": "Show RustProxy cache diagnostics only on HIT (retain origin headers)",
+ "cacheDetailedStatus": "X-Cache shows STALE and REVALIDATED instead of HIT",
"phpHintEnabled": "Run configured PHP file extensions through an already-running PHP-FPM pool. RustProxy does not start PHP; non-PHP files remain static.",
"phpHintPathInfo": "Split /static.php/skins/file.css into SCRIPT_FILENAME=static.php and PATH_INFO=/skins/file.css. Useful for Roundcube; usually unnecessary for WordPress. Off by default.",
"phpHintPassAuthorization": "Pass the incoming Authorization header as HTTP_AUTHORIZATION to PHP (API/Bearer/Basic authentication). Disable if not needed.",
diff --git a/langs/pl_pl.json b/langs/pl_pl.json
index 4704603..9366f20 100644
--- a/langs/pl_pl.json
+++ b/langs/pl_pl.json
@@ -980,6 +980,11 @@
"vhHttp3Enabled": "Włącz HTTP/3 dla tego vhosta",
"vhCloudflareClientIp": "Używaj zweryfikowanego IP klienta z Cloudflare",
"vhTimingHeaders": "Udostępniaj diagnostykę Server-Timing",
+ "vhTimingHeaderNames": "Nazwy metryk Server-Timing",
+ "vhTimingHeaderNamesStandard": "Reverse proxy (proxy, upstream, proxy-cache)",
+ "vhTimingHeaderNamesCdn": "Brzeg CDN (edge, origin, cdn-cache)",
+ "vhTimingHeaderNamesLegacy": "Sprzed 0.38.2 (proxy, origin, cache)",
+ "vhTimingAllowOrigin": "Timing-Allow-Origin (originy, które mogą czytać czasy, albo *)",
"vhRateEnabled": "Włącz limit żądań per IP klienta",
"vhRateRequests": "Żądania na okno",
"vhRateWindow": "Okno (sekundy)",
@@ -1525,7 +1530,7 @@
"vhBackendDiagnostics": "Diagnostyka backendu",
"vhBackendHeader": "Udostępniaj wybrany backend (X-RustProxy-Backend)",
"vhBackendTimingHeader": "Udostępniaj czas odpowiedzi backendu (X-RustProxy-Backend-Time)",
- "vhBackendDiagnosticsHelp": "Opcjonalne nagłówki odpowiedzi. Czas backendu oznacza czas od wysłania żądania do otrzymania nagłówków odpowiedzi; odpowiedzi obsłużone bez kontaktu z originem nie raportują backendu.",
+ "vhBackendDiagnosticsHelp": "Opcjonalne nagłówki odpowiedzi. Server-Timing jest dopisywany do metryk originu; odpowiedzi z cache zastępują zapisane metryki. Czas backendu oznacza czas od wysłania żądania do otrzymania nagłówków odpowiedzi; odpowiedzi obsłużone bez kontaktu z originem nie raportują backendu.",
"authModeHelp": "Wybierz dostawcę tożsamości i obsługiwaną metodę integracji. Forward Auth sprawdza sesję u dostawcy, a OIDC zapewnia logowanie centralne z callbackiem na domenie chronionej aplikacji. Stare konfiguracje Vhostów pozostają obsługiwane.",
"taAdvanced": "Zaawansowane ustawienia Tinyauth",
"notfound": "Hosty 404",
@@ -2603,6 +2608,7 @@
"backendHealthOverride": "Osobny health check dla tego backendu",
"backendHealthOverridesHelp": "Bez nadpisania backend dziedziczy ustawienia vhosta. Wylaczenie monitorowania nie blokuje lokalizacji przypisanych do backendu, ale wylacza probe aktywna i pasywne wykluczanie.",
"cacheOnlyHits": "Pokazuj naglowki RustProxy tylko dla HIT (zachowaj naglowki backendu)",
+ "cacheDetailedStatus": "X-Cache pokazuje STALE i REVALIDATED zamiast HIT",
"phpHintEnabled": "Uruchamia pliki o wskazanych rozszerzeniach przez już działającą pulę PHP-FPM. RustProxy nie uruchamia PHP; inne pliki nadal są statyczne.",
"phpHintPathInfo": "Rozdziela /static.php/skins/file.css na SCRIPT_FILENAME=static.php i PATH_INFO=/skins/file.css. Potrzebne np. w Roundcube; zwykle zbędne w WordPressie. Domyślnie wyłączone.",
"phpHintPassAuthorization": "Przekazuje nagłówek Authorization do PHP jako HTTP_AUTHORIZATION (np. API/Bearer/Basic). Wyłącz, gdy aplikacja go nie używa.",
diff --git a/src/admin/logging_api.rs b/src/admin/logging_api.rs
index 049e41f..8d30788 100644
--- a/src/admin/logging_api.rs
+++ b/src/admin/logging_api.rs
@@ -27,7 +27,7 @@ async fn logs(
|| filter
.cache
.as_ref()
- .is_some_and(|v| !matches!(v.as_str(), "HIT" | "MISS" | "BYPASS" | "-"))
+ .is_some_and(|v| !matches!(v.as_str(), "HIT" | "STALE" | "REVALIDATED" | "MISS" | "BYPASS" | "-"))
{
return Err(ApiError(
StatusCode::BAD_REQUEST,
diff --git a/src/admin/openapi.json b/src/admin/openapi.json
index 349af5d..515484a 100644
--- a/src/admin/openapi.json
+++ b/src/admin/openapi.json
@@ -2,7 +2,7 @@
"openapi": "3.0.3",
"info": {
"title": "RustProxy Administration API",
- "version": "0.38.1",
+ "version": "0.38.2",
"description": "Administration API for the active panel origin. Sign in through the panel; the same-origin HttpOnly cookie authenticates all private operations. Mutations also require the exact Origin, X-RustProxy-Request: 1 and a session-bound X-CSRF-Token. Loopback HTTP is the default; Settings can enable HTTPS before using a non-loopback administration bind. This document contains no live configuration or credentials. Object schemas marked extensible are summaries: full configuration validation is authoritative in Rust. The API also permits explicitly scoped GeneralApiBearer tokens on a narrow route allowlist, with RO/RW and source CIDR checks; API-token management and Prometheus-token management are browser-session-only."
},
"servers": [
@@ -756,6 +756,12 @@
"default": null,
"description": "If true, only emit cache diagnostic headers for actual HIT responses, never MISS/BYPASS. null inherits global expose_only_hits. Via is controlled independently."
},
+ "expose_detailed_status": {
+ "type": "boolean",
+ "nullable": true,
+ "default": null,
+ "description": "If true, X-Cache reports STALE or REVALIDATED instead of HIT for such responses. null inherits global expose_detailed_status."
+ },
"rules": {
"type": "array",
"maxItems": 128,
@@ -852,7 +858,19 @@
"timing_headers": {
"type": "boolean",
"default": false,
- "description": "Expose Server-Timing diagnostics for this vhost."
+ "description": "Append Server-Timing diagnostics for this vhost to the origin's own Server-Timing metrics. Responses served from the cache drop the stored origin metrics."
+ },
+ "timing_header_names": {
+ "type": "string",
+ "enum": ["standard", "cdn", "legacy"],
+ "default": "standard",
+ "description": "Metric names in Server-Timing. standard (reverse proxy): proxy;dur, upstream;dur, proxy-cache;desc. cdn (RustProxy is the outermost CDN-like edge): edge;dur, origin;dur, cdn-cache;desc. legacy (before 0.38.2): proxy;dur, origin;dur, cache;desc. The cache value is HIT, MISS, BYPASS, STALE or REVALIDATED."
+ },
+ "timing_allow_origin": {
+ "type": "array",
+ "items": { "type": "string" },
+ "maxItems": 16,
+ "description": "Timing-Allow-Origin sent with Server-Timing: origins such as https://app.example.com that may read the timings from scripts, or a single \"*\". Empty sends no header (same-origin scripts can always read them)."
},
"backend_header": {
"type": "boolean",
@@ -2461,6 +2479,11 @@
"default": false,
"description": "Suppress RustProxy cache diagnostic headers on MISS/BYPASS. Cache HIT diagnostics remain governed by expose_* flags. The independently configured Via header is unaffected."
},
+ "expose_detailed_status": {
+ "type": "boolean",
+ "default": false,
+ "description": "X-Cache reports STALE (served past freshness: grace, stale-while-revalidate, stale-if-error, collapse timeout) or REVALIDATED (confirmed by the origin with 304) instead of HIT. These still count as HIT for expose_only_hits and the hit ratio."
+ },
"http_invalidation_allowed_cidrs": {
"type": "array",
"description": "Optional IP/CIDR allowlist for HTTP BAN and PURGE on matched public vhosts. Empty disables all HTTP invalidation. Max 32 entries; /0 networks forbidden. Trusted reverse proxies must provide an authenticated forwarding chain.",
@@ -11361,6 +11384,8 @@
"type": "string",
"enum": [
"HIT",
+ "STALE",
+ "REVALIDATED",
"MISS",
"BYPASS",
"-"
diff --git a/src/admin/web/app/settings.js b/src/admin/web/app/settings.js
index 128e321..4d1c029 100644
--- a/src/admin/web/app/settings.js
+++ b/src/admin/web/app/settings.js
@@ -37,7 +37,7 @@ function renderSettings() {
$("cache-query").checked = !!c.bypass_query; $("cache-prefixes").value = (c.bypass_prefixes || []).join("\n");
$("cache-http-invalidation-cidrs").value = (c.http_invalidation_allowed_cidrs || []).join("\n");
$("cache-static-cookie").checked = c.static_ignore_cookies !== false; $("cache-static-extensions").value = (c.static_extensions || []).join("\n");
- $("cache-status-header").checked = !!c.expose_status; $("cache-hits-header").checked = !!c.expose_hits; $("cache-rfc-header").checked = !!c.expose_cache_status; $("cache-resident-age-header").checked = !!c.expose_resident_age; $("cache-only-hits").checked = !!c.expose_only_hits;
+ $("cache-status-header").checked = !!c.expose_status; $("cache-hits-header").checked = !!c.expose_hits; $("cache-rfc-header").checked = !!c.expose_cache_status; $("cache-resident-age-header").checked = !!c.expose_resident_age; $("cache-only-hits").checked = !!c.expose_only_hits; $("cache-detailed-status").checked = !!c.expose_detailed_status;
const viaHeader = c.via_header === undefined ? "RustProxy" : c.via_header;
$("cache-via-enabled").checked = viaHeader !== null; $("cache-via-value").value = viaHeader || "RustProxy"; syncCacheVia();
setCacheMemoryPresetSelection(["conservative", "recommended", "performance"].includes(c.memory_preset) ? c.memory_preset : null);
@@ -376,7 +376,7 @@ bindSettingsForm("response-form", next => {
next.compression = { min_bytes: Number($("compress-min").value) }; for (const name of ["gzip", "br", "zstd", "deflate"]) next.compression[name] = $(`compress-${name}`).checked;
}, "response", next => ({ server_header: next.server_header, diagnostic_headers: next.diagnostic_headers, compression: next.compression }));
bindSettingsForm("cache-form", next => {
- next.cache = { ...(next.cache || {}), enabled: $("cache-enabled").checked, varnish_compatible: $("cache-varnish-compatible").checked, varnish_grace_seconds: Number($("cache-varnish-grace").value), memory_preset: selectedCacheMemoryPreset, max_bytes: Math.round(Number($("cache-memory").value) * 1048576), transient_max_bytes: Math.round(Number($("cache-transient-memory").value) * 1048576), max_object_bytes: Number($("cache-object").value) * 1024, max_entries: Number($("cache-entries").value), hot_eviction_max_objects: Number($("cache-eviction-limit").value), hot_auto_trim_enabled: $("cache-auto-trim-enabled").checked, hot_auto_trim_after_seconds: Number($("cache-auto-trim-after").value), hot_auto_trim_target_percent: Number($("cache-auto-trim-target").value), cold_enabled: $("cache-cold-enabled").checked, cold_preset: selectedCacheColdPreset, cold_path: $("cache-cold-path").value.trim(), cold_max_bytes: Math.round(Number($("cache-cold-bytes").value) * 1048576), cold_max_entries: Number($("cache-cold-entries").value), cold_queue_max_bytes: Math.round(Number($("cache-cold-queue-bytes").value) * 1048576), cold_gc_interval_seconds: Number($("cache-cold-gc-interval").value), cold_gc_max_delete: Number($("cache-cold-gc-max-delete").value), cold_after_seconds: Number($("cache-cold-after").value), cold_max_hot_seconds: Number($("cache-cold-max-hot").value), cold_on_idle: $("cache-cold-on-idle").checked, cold_on_age: $("cache-cold-on-age").checked, cold_on_lru: $("cache-cold-on-lru").checked, cold_on_shutdown: $("cache-cold-on-shutdown").checked, max_ttl_seconds: Number($("cache-ttl").value), default_ttl_seconds: Number($("cache-default-ttl").value), collapse_enabled: $("cache-collapse-enabled").checked, collapse_wait_timeout_ms: Number($("cache-collapse-timeout").value), collapse_timeout_fallback: $("cache-collapse-fallback").value, stale_if_error_timeout: $("cache-sie-timeout").checked, stale_if_error_connection: $("cache-sie-connection").checked, stale_if_error_dns: $("cache-sie-dns").checked, stale_if_error_tls: $("cache-sie-tls").checked, stale_if_error_statuses: $("cache-sie-statuses").value.split(/[\s,]+/).filter(Boolean).map(Number), proactive_refresh_enabled: $("cache-proactive-enabled").checked, proactive_refresh_before_expiry_seconds: Number($("cache-proactive-before").value), proactive_refresh_percent: Number($("cache-proactive-percent").value), proactive_refresh_max_inflight: Number($("cache-proactive-inflight").value), bypass_query: $("cache-query").checked, bypass_prefixes: $("cache-prefixes").value.split(/\r?\n/).map(v => v.trim()).filter(Boolean), http_invalidation_allowed_cidrs: $("cache-http-invalidation-cidrs").value.split(/[\n,]+/).map(v => v.trim()).filter(Boolean), static_ignore_cookies: $("cache-static-cookie").checked, static_extensions: $("cache-static-extensions").value.split(/[\n,]+/).map(v => v.trim().replace(/^\./, "").toLowerCase()).filter(Boolean), expose_status: $("cache-status-header").checked, expose_hits: $("cache-hits-header").checked, expose_cache_status: $("cache-rfc-header").checked, expose_resident_age: $("cache-resident-age-header").checked, expose_only_hits: $("cache-only-hits").checked, via_header: $("cache-via-enabled").checked ? $("cache-via-value").value.trim() : null, rules: cacheRulesEditor ? cacheRulesEditor.read() : (next.cache?.rules || []) };
+ next.cache = { ...(next.cache || {}), enabled: $("cache-enabled").checked, varnish_compatible: $("cache-varnish-compatible").checked, varnish_grace_seconds: Number($("cache-varnish-grace").value), memory_preset: selectedCacheMemoryPreset, max_bytes: Math.round(Number($("cache-memory").value) * 1048576), transient_max_bytes: Math.round(Number($("cache-transient-memory").value) * 1048576), max_object_bytes: Number($("cache-object").value) * 1024, max_entries: Number($("cache-entries").value), hot_eviction_max_objects: Number($("cache-eviction-limit").value), hot_auto_trim_enabled: $("cache-auto-trim-enabled").checked, hot_auto_trim_after_seconds: Number($("cache-auto-trim-after").value), hot_auto_trim_target_percent: Number($("cache-auto-trim-target").value), cold_enabled: $("cache-cold-enabled").checked, cold_preset: selectedCacheColdPreset, cold_path: $("cache-cold-path").value.trim(), cold_max_bytes: Math.round(Number($("cache-cold-bytes").value) * 1048576), cold_max_entries: Number($("cache-cold-entries").value), cold_queue_max_bytes: Math.round(Number($("cache-cold-queue-bytes").value) * 1048576), cold_gc_interval_seconds: Number($("cache-cold-gc-interval").value), cold_gc_max_delete: Number($("cache-cold-gc-max-delete").value), cold_after_seconds: Number($("cache-cold-after").value), cold_max_hot_seconds: Number($("cache-cold-max-hot").value), cold_on_idle: $("cache-cold-on-idle").checked, cold_on_age: $("cache-cold-on-age").checked, cold_on_lru: $("cache-cold-on-lru").checked, cold_on_shutdown: $("cache-cold-on-shutdown").checked, max_ttl_seconds: Number($("cache-ttl").value), default_ttl_seconds: Number($("cache-default-ttl").value), collapse_enabled: $("cache-collapse-enabled").checked, collapse_wait_timeout_ms: Number($("cache-collapse-timeout").value), collapse_timeout_fallback: $("cache-collapse-fallback").value, stale_if_error_timeout: $("cache-sie-timeout").checked, stale_if_error_connection: $("cache-sie-connection").checked, stale_if_error_dns: $("cache-sie-dns").checked, stale_if_error_tls: $("cache-sie-tls").checked, stale_if_error_statuses: $("cache-sie-statuses").value.split(/[\s,]+/).filter(Boolean).map(Number), proactive_refresh_enabled: $("cache-proactive-enabled").checked, proactive_refresh_before_expiry_seconds: Number($("cache-proactive-before").value), proactive_refresh_percent: Number($("cache-proactive-percent").value), proactive_refresh_max_inflight: Number($("cache-proactive-inflight").value), bypass_query: $("cache-query").checked, bypass_prefixes: $("cache-prefixes").value.split(/\r?\n/).map(v => v.trim()).filter(Boolean), http_invalidation_allowed_cidrs: $("cache-http-invalidation-cidrs").value.split(/[\n,]+/).map(v => v.trim()).filter(Boolean), static_ignore_cookies: $("cache-static-cookie").checked, static_extensions: $("cache-static-extensions").value.split(/[\n,]+/).map(v => v.trim().replace(/^\./, "").toLowerCase()).filter(Boolean), expose_status: $("cache-status-header").checked, expose_hits: $("cache-hits-header").checked, expose_cache_status: $("cache-rfc-header").checked, expose_resident_age: $("cache-resident-age-header").checked, expose_only_hits: $("cache-only-hits").checked, expose_detailed_status: $("cache-detailed-status").checked, via_header: $("cache-via-enabled").checked ? $("cache-via-value").value.trim() : null, rules: cacheRulesEditor ? cacheRulesEditor.read() : (next.cache?.rules || []) };
}, "cache");
bindSettingsForm("transform-form", next => {
next.transform = {
diff --git a/src/admin/web/cache-panel.js b/src/admin/web/cache-panel.js
index 8bc2beb..f7d8f56 100644
--- a/src/admin/web/cache-panel.js
+++ b/src/admin/web/cache-panel.js
@@ -165,7 +165,8 @@
$("cp-cold-bytes").textContent = fmtBytes(coldBytes);
$("cp-cold-disk-detail").textContent = `${t("cacheLimitShort")}: ${fmtBytes(coldLimit)} · ${coldPercent.toFixed(1)}%`;
$("cp-ratio").textContent = `${fmt((all ? (m.hit_ratio || 0) : (hits + misses ? hits / (hits + misses) : 0)) * 100, 1)}%`;
- $("cp-requests").textContent = `${number(all ? m.hits : hits)} HIT / ${number(all ? m.misses : misses)} MISS`;
+ const staleHits = total("stale"), revalidatedHits = total("revalidated");
+ $("cp-requests").textContent = `${number(all ? m.hits : hits)} HIT / ${number(all ? m.misses : misses)} MISS${staleHits ? ` · ${number(staleHits)} STALE` : ""}${revalidatedHits ? ` · ${number(revalidatedHits)} REVALIDATED` : ""}`;
const bypasses = all ? (Number(m.bypasses) || 0) : total("bypasses");
$("cp-bypass").textContent = number(bypasses);
renderLiveChart({ hits: all ? (Number(m.hits) || 0) : hits, misses: all ? (Number(m.misses) || 0) : misses, bypasses });
diff --git a/src/admin/web/css/30-overview.css b/src/admin/web/css/30-overview.css
index 3fed522..cd17fcf 100644
--- a/src/admin/web/css/30-overview.css
+++ b/src/admin/web/css/30-overview.css
@@ -49,6 +49,10 @@ html[data-theme=cream] :is(.card, .stat, dialog) {
margin: 4px 0;
}
+.status-stale {
+ color: var(--accent);
+}
+
.status-good,
.stat:first-child small,
.acl-policy-preview-head .is-allow,
diff --git a/src/admin/web/index.html b/src/admin/web/index.html
index e3e703a..8f9e00c 100644
--- a/src/admin/web/index.html
+++ b/src/admin/web/index.html
@@ -3008,6 +3008,9 @@
+