v0.41.3_hotfix1

This commit is contained in:
Mateusz Gruszczyński committed 2026-11-24 23:16:54 +01:00
1 parent dd9ecc48f1
commit 0d0100acbc
35 files changed
+1007 -417

No files matched your search

+5 -3
View File
@@ -7,7 +7,7 @@ RustProxy exposes an authenticated administration API on the **separate administ
The current bundled `src/admin/openapi.json` declares these operations (among others):
| Method and path | Purpose |
|---|---|
| --- | --- |
| `GET /healthz` | Minimal health response, without privileged state. |
| `GET /api/auth/status` | Whether first-time administrator setup is required. |
| `POST /api/auth/login` · `POST /api/auth/logout` | Start/end a browser admin session. |
@@ -37,6 +37,8 @@ The current bundled `src/admin/openapi.json` declares these operations (among ot
Some paths have additional DELETE/PATCH operations, job-status resources, query parameters or restricted actions. Use OpenAPI for the **actual fields/methods**, not guesses based on a table. `GET /metrics` here is not a replacement for the separate Prometheus exporter.
The full and live status responses include `metrics.cache_request_outcomes` (`hits`, `misses`, `bypasses`, `other`) and `metrics.completed_success`. Full and live `GET /api/cache` include `request_outcomes`, using the same process counters. These are final client-request classifications; existing `cache` / Cache `metrics` fields remain technical operation counters. Domain outcomes count final requests, while diagnostic reasons can include separate refresh and collapse events.
For browser polling, `GET /api/cache?view=live`, `GET /api/transform?view=live` and `GET /api/traffic?view=live` omit static response members that do not need to be retransmitted on every interval. Their `revision` identifies the active configuration; Cache and Traffic additionally return `catalog_version` (a fingerprint of the effective Vhost list, including Docker publications). If either revision or this fingerprint changes, clients should fetch the corresponding endpoint without `view=live` and refresh their cached static fields. Requests without `view=live` remain the complete compatibility form. Cache live responses contain metrics/dashboard/bans, Transform live responses contain resources/metrics, and Traffic live responses retain current settings/GeoIP/analytics while omitting the static Vhost list. Full Cache and Traffic responses provide readable `vhosts[].label` and `vhosts[].docker` together with the stable `id`; Docker-generated IDs are valid cache purge/invalidation and analytics scopes. Unknown `view` values are rejected.
Certificate inspection accepts `{ "cert_file": "filename.pem" }` for a managed file or an absolute external path and returns `{ "cert_file": "...", "covered_hosts": ["example.com"] }`. It applies the existing certificate-file trust and size checks and reads no private key. It makes no configuration or permission changes. This POST requires the signed-in administrator's normal Origin, request-marker and CSRF checks; general RO/RW API tokens and certificate-only credentials cannot call it.
@@ -46,7 +48,7 @@ Certificate inspection accepts `{ "cert_file": "filename.pem" }` for a managed f
The administration listener is HTTP on loopback (`127.0.0.1:9090`) by default and is separate from the public Vhost listeners. No administrator password is bundled: complete first-time setup with the local CLI (`admin setup-token` or `admin init`). For remote access prefer an SSH tunnel; for direct access enable administration HTTPS with a trusted certificate and restrict the network before binding outside loopback.
| Credential | Scope |
|---|---|
| --- | --- |
| Browser session | Full administration. HttpOnly, SameSite=Strict cookie (Secure on HTTPS), absolute lifetime 7–30 days. Writes require matching Origin, `X-CSRF-Token` and `X-RustProxy-Request: 1`. |
| General API token (`ro` / `rw`) | Created in **Settings → Security → API tokens** (see [API tokens in the panel](#api-tokens-in-the-panel)). Displayed once, stored as a hash, bound to a mandatory IP/CIDR allowlist. Sent as `Authorization: Bearer <token>`. `ro` reads resources and sections; `rw` also writes configuration sections and selected operations. Cannot manage authentication, backups, tokens or certificate credentials. |
| Certificate API key | Key ID + Bearer token limited to specific certificate IDs and actions (reload by default, deploy opt-in). |
@@ -83,7 +85,7 @@ This is a special-risk topology. Configure a fixed HTTPS public origin, an allow
The section name in the URL and its corresponding JSON member in a full configuration are:
| Section path (`/api/config/…`) | JSON member(s) in `config` |
|---|---|
| --- | --- |
| `listeners` | `listeners` |
| `docker-agents` | `docker_agents` |
| `http2` | `http2` |
+2
View File
@@ -301,6 +301,8 @@ Where they show:
| `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`) |
Panel HIT/MISS/BYPASS counts are final request outcomes, recorded once at response headers. STALE and REVALIDATED are HIT subcategories; collapsed requests served from the newly filled cache are HIT, even if their first lookup missed. Background refresh reasons remain visible as maintenance events without incrementing client HIT. Technical lookup counters remain separate and may record several operations per request. Domain counters reset when a cache representation change clears their catalog; global request counters reset only on service restart.
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
+3 -2
View File
@@ -140,8 +140,9 @@ Under **Settings → Appearance → Charts**, **Show values on hover** is **off
## Interpreting charts
- The **Cache hit ratio** donut shows cumulative `HIT / (HIT + MISS)`: BYPASS and requests outside cache are deliberately excluded from its denominator.
- The **Cache outcomes** compact horizontal 100% bar is **hidden by default**; enable it in **Settings → Appearance → Dashboard layout** or the Overview layout editor. It summarizes **cumulative request counters since the current service process started**, not recent polling intervals. The upper-right number shows the total HTTP requests since service start (full description in its tooltip and accessible label); the legend shows counts and percentages for HIT, MISS, BYPASS and OTHER. The percentages use all HTTP requests as the denominator. BYPASS includes requests where the cache path was considered but disabled/skipped (including globally disabled cache); OTHER covers requests without a cache decision, e.g. early rejected or redirect paths. These are request counts, not bytes; service restarts reset them. Values appear immediately with the first HTTP request; refreshing or pausing the browser does not reset totals. If independently counted cache outcomes exceed the request counter (e.g. while snapshots are inconsistent or a request incurs multiple cache events), the summary shows unavailable rather than fabricating OTHER or a normalized 100% breakdown. The separate recent cache trend chart remains unchanged.
- The **Cache hit ratio** donut and recent cache activity charts use final HTTP request outcomes, not internal cache lookups. The cumulative ratio is `HIT / (HIT + MISS)`; BYPASS and OTHER are excluded. A request that waits for a fill and then hits, serves stale on error or receives a validated cached response is one HIT.
- The **Cache outcomes** compact horizontal 100% bar is **hidden by default**; enable it in **Settings → Appearance → Dashboard layout** or the Overview layout editor. It summarizes cumulative mutually exclusive final HTTP request outcomes since service start. The upper-right number and percentages use the sum of HIT, MISS, BYPASS and OTHER from the same snapshot. Requests are classified when response headers are ready; rejected requests and cancellations before headers without a final response are OTHER. Requests still awaiting a response are not counted yet. BYPASS includes requests where caching was considered but disabled or skipped; OTHER includes redirects, local responses and early rejects without a cache decision. Background refreshes and repeated lookups cannot add client request outcomes. Reloading the browser or changing cache settings does not reset these process counters; a service restart does. No data is shown before the first classified request.
- **Error share** uses completed exchanges with an error divided by all completed admitted exchanges in the same sampling interval (not new requests); a period with no completions has no ratio. The HTTP protocol shares use the sum of incoming H1, H2 and H3 counters; H1 includes HTTP/1.0 and HTTP/1.1.
- Live views are process/sampling-based and can show no-data when an integration has not reported yet.
+1 -1
View File
@@ -80,7 +80,7 @@ RustProxy is a single service that combines a reverse proxy, a static/PHP web se
## Monitoring and logs
- Overview dashboard with requests per second, bandwidth, status codes, error share, cache hit ratio, protocol mix, system load, backend health, requests rejected by limits and nearest certificate expiry.
- Overview dashboard with requests per second, bandwidth, status codes, completed-exchange error share, final-request cache hit ratio and outcomes, protocol mix, system load, backend health, requests rejected by limits and nearest certificate expiry.
- Optional **Memory breakdown** card: process RSS split into cache data, cache bookkeeping, cache buffers, allocator-held free memory, mapped files and the rest of the process, with glibc heap statistics and an "outside cache" trend for spotting leaks.
- Customizable dashboard layouts (drag-and-drop with a live drop placeholder, keyboard moves, per-block width, explicit gap filling), 18 built-in layouts and up to 16 saved presets per administrator.
- Per-Vhost, per-backend, per-Web-Service and per-Stream statistics.
+1 -1
View File
@@ -138,7 +138,7 @@ curl -fsS -H "Authorization: Bearer $RUSTPROXY_API_TOKEN" \
guaranteed exact one-second rolling averages; poll every **2–5 seconds**.
`requests_per_second_average` is a separate **uptime average**.
- `traffic.error_percent` is lifetime errors divided by completed requests;
`cache.hit_percent` is lifetime HOT/COLD hit ratio from cache metrics.
`cache.hit_percent` is the lifetime technical HOT/COLD hit ratio from cache metrics. The panel and Grafana request-outcome charts use separate final HTTP request counters: `rust_proxy_cache_request_hits_total`, `rust_proxy_cache_request_misses_total`, `rust_proxy_cache_request_bypasses_total`, and `rust_proxy_cache_request_other_total`. A request is classified once at response headers (or OTHER on pre-header cancellation/rejection); ongoing requests are excluded. Internal lookups and repeated fill attempts remain in the existing technical counters. Background 304 refreshes are maintenance and no longer increment HIT. `rust_proxy_requests_completed_success_total` complements `rust_proxy_errors_total` for the error share of completed admitted exchanges. HTTP/1.x counters include both 1.0 and 1.1.
Zero-denominator percentages are `null` unless a cache ratio has a defined
default. The `traffic.network_rx_bytes_per_second` and
`network_tx_bytes_per_second` fields are **host** interface rates, not