This commit is contained in:
Mateusz Gruszczyński committed 2026-11-19 12:40:17 +01:00
1 parent d4a604970e
commit 38a23e2210
40 files changed
+928 -532

No files matched your search

+4
View File
@@ -162,3 +162,7 @@ X-RustProxy-Certificate-Key: <key-id>
```
The credential can be used only for allowed certificate reload/deploy operations, not configuration, users, metrics or secret management. Non-loopback use requires the appropriate administration HTTPS security boundary. Rotate broad or legacy credentials. See [Certificates](CERTIFICATES.md).
## Static cache Vary controls
The global `cache.static_ignore_vary_cookie` boolean defaults to `true` and can be overridden per Vhost by `cache.static_ignore_vary_cookie` (`null` inherits). This option works only with `static_ignore_cookies` and configured static extensions. For otherwise cacheable, explicitly `public` responses, RustProxy removes `Cookie` from `Vary`, preserving all other Vary dimensions; Set-Cookie, private and no-store responses are not eligible. Use only for responses independent of Cookie. Details are in [Cache](CACHE.md#cache-controls-in-settings).
+12 -2
View File
@@ -5,7 +5,17 @@ RustProxy provides an optional shared HTTP response cache with a bounded in-memo
### Cache controls in Settings
The **Rules** subtab holds the conditional cache rules described in [Cache rules (VCL-style)](#cache-rules-vcl-style).
The static-extension cookie-bypass warning sits with its extension list, separate from **Cache response headers** options. Only enable this optimization for files whose bytes do not depend on the user's session. `Cookie` can then be omitted from the shared cache key for the configured extensions; responses with `Set-Cookie`, `private`, `no-store` or `Vary: Cookie` remain uncacheable.
The **Static & diagnostics** subtab provides **Ignore request cookies for static files** (`cache.static_ignore_cookies`, on by default) and **Ignore Vary: Cookie for public static assets** (`cache.static_ignore_vary_cookie`, on by default), plus the allowed extensions (`cache.static_extensions`). Both options are effective only on the configured file extensions and work together: the request Cookie is excluded from the cache key, and a qualifying backend `Vary: Cookie` is removed from the stored and delivered response. Other Vary dimensions (such as `Accept-Language` or `Accept-Encoding`) remain intact. A vhost may override either option independently, or inherit the global values.
**Safety requirement:** use both options only when the complete static response (body **and headers**) is identical for all visitors regardless of Cookie. `Vary: Cookie` is a declaration that content may vary, so overriding it on a genuinely session-dependent file can expose one user's cached variant to another. RustProxy applies this override only to responses with an explicit `Cache-Control: public` directive, positive remaining freshness (without mandatory revalidation) and no `Set-Cookie`, `private`, `no-store` or invalid Vary. A zero-TTL response, including `public` with no configured fallback TTL, retains `Vary: Cookie` even if it can be stored for later revalidation. If the response is not cacheable, `Vary: Cookie` is passed through unchanged. Do not enable this optimization for user-specific downloads, generated PDFs, account JSON, or any path where Flask or another origin changes content according to a session cookie; prefer removing the needless `Vary: Cookie` at the origin where possible.
## `Vary` matching (RFC 9111 §4.1)
Cached variants use the response's `Vary` field names together with the original request's nominated fields. Reuse requires a match in **every** retained `Vary` dimension; `Vary: *` is never reusable. An absent request field is not equivalent to a present but empty field.
To avoid unnecessary variants, RustProxy normalizes optional whitespace around commas, joins repeated header lines **only** for known comma-list fields, and preserves quoted strings. For valid `Accept-Language`, `Accept-Encoding` and `Accept-Charset` values it also normalizes case-insensitive tokens and equivalent `q` weights (`q=1` and an omitted weight are equivalent). `Accept` media type/subtype casing is normalized without changing case-sensitive parameter values. List order remains intact; values of `Cookie`, `User-Agent` and other opaque/custom fields are not parsed or reordered. Unsupported or malformed values fall back to conservative bytewise matching (aside from outer HTTP whitespace). This is **deliberately limited semantic normalization**, not a promise to reinterpret every possible extension header.
The corrected key algorithm uses a new internal variant-key domain. On upgrading an existing installation to the updated **0.38.7** sources, previously persisted COLD variants keyed by the older algorithm will miss and be repopulated; unvaried cached responses do not change. These cold misses are intentional to avoid unsafe cross-version reuse. No configuration changes or cache clearing are required.
## Enable caching safely
@@ -77,7 +87,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**. A limited static-file cookie exception exists for configured static extensions and does not override `private`, `no-store`, `Set-Cookie` or `Vary: Cookie`.
- 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.
- 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.
+4
View File
@@ -108,3 +108,7 @@ The tab lists the existing keys first: permission badge (*reload only* or *deplo
- **SNI field does not auto-fill:** check the read status below the paths, grant access to the public certificate, then use **Read names from certificate**. A manually edited/cleared field is intentionally preserved until this explicit action; a certificate without DNS SAN entries supplies no names.
Keep a private encrypted application backup and a separate copy of any external certificate/key material. See [Backup and recovery](BACKUP.md) and [Security](SECURITY.md).
## Generate form confirmations
In **Certificates → Generate**, **Sign SOA discovery query** (RFC 2136), **I accept the Let's Encrypt subscriber agreement**, and **I confirm production issuance** use the same on/off switch presentation as other settings when **Settings → Appearance → Show on/off settings as switches** is enabled. The agreement and production confirmations remain required for applicable submissions; changing their appearance does not auto-confirm anything.
+1 -1
View File
@@ -150,7 +150,7 @@ In **Docker vhosts**, select the service and set:
| **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.
| **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. Stored as `timing_headers`, `backend_header`, `backend_timing_header`. |
| **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. |
### HTTP Basic Auth for Docker apps
+2 -2
View File
@@ -52,7 +52,7 @@ RustProxy is a single service that combines a reverse proxy, a static/PHP web se
## Access and security
- IP/CIDR and DNS/DDNS allow/deny rules, reusable ACL profiles (up to eight per Vhost).
- Country allow/deny lists with automatic GeoIP database updates.
- Country allow/deny lists with automatic GeoIP database updates and a searchable country picker in global and Vhost security settings.
- Request rate limiting per Vhost and globally, with burst and `Retry-After`.
- HTTP method policy, request Content-Type denylist and User-Agent blocking.
- Security headers: HSTS, CSP, X-Frame-Options, Referrer-Policy, Permissions-Policy, `nosniff`.
@@ -64,7 +64,7 @@ RustProxy is a single service that combines a reverse proxy, a static/PHP web se
## Cache and delivery
- Shared HTTP cache with a memory tier (HOT) and an optional disk tier (COLD).
- RFC 9111 freshness, validators and `Vary`; stale-while-revalidate, stale-if-error and request coalescing.
- 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.
- RFC 9211 `Cache-Status` and optional `X-Cache` diagnostics.
+1 -1
View File
@@ -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.6","revision":4,"uptime_seconds":120,
{"status":"ok","mode":"headless","version":"0.38.7","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}]}
+1 -1
View File
@@ -36,7 +36,7 @@ Guides for operating RustProxy: installation, publishing services, security, cer
## Performance and delivery
- [Cache](CACHE.md) — HOT (memory) and COLD (disk) cache, freshness, `Cache-Status` and invalidation.
- [Cache](CACHE.md) — HOT/COLD cache, RFC 9111 `Vary` matching/normalization, safe static-asset cookie exceptions, freshness, `Cache-Status` and invalidation.
- [Response delivery](RESPONSE_DELIVERY.md) — compression, transformations and response headers.
## Operations
+4
View File
@@ -39,6 +39,10 @@ image/*
Check with `curl -i -H 'Content-Type: multipart/form-data; boundary=test' --data 'x' https://your-vhost.example/upload` (expected **403**) and a valid application request without the blocked type. Applying this filter is **not a fix for an underlying PHP/application vulnerability**: keep PHP, extensions and application code patched.
## Country access picker
Under **Vhosts → Edit → Security → Country access**, choose `Off`, `Block` or `Allow`, then search and select country names or ISO alpha-2 codes using the same picker as **Settings → Policies → Country access**. Selected codes are saved in the existing `rate_limit.country_access.countries` field. The picker is disabled in `Off` mode; switching back to `Allow` or `Block` preserves the selection. Country matching still needs the GeoIP database. No configuration migration is required.
## Source and backends
- **Reverse Proxy:** one Vhost has a backend pool. Each member has a configured URL, ID, enabled flag, weight, optional backup/drain state, health settings and capacity limits.