This commit is contained in:
Mateusz Gruszczyński committed 2026-11-23 11:07:13 +01:00
1 parent 27b640a0df
commit aa27866531
46 files changed
+3368 -189

No files matched your search

+17
View File
@@ -2,6 +2,23 @@
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.41.0 — Conditional routing: request conditions and whole-host rules
- **Location conditions (HAProxy `use_backend … if <acl>` style):** a custom location accepts `conditions` — up to 16 tests on `header`, `cookie`, `query` (parameter), `method`, `ip` (client address after trusted forwarding/Cloudflare, `cidr` with IPs or networks), `host` or `country` (GeoIP/Cloudflare), with the operators `equals`, `exists`, `prefix`, `suffix`, `contains`, `regex` and `cidr`, `negate` and `ignore_case`. All conditions must hold (AND); a condition matches when any of its values matches (OR). A location whose conditions fail is skipped and the next candidate is used, so `/api/` + `X-Beta: 1` → beta backends can sit next to a plain `/api/`. For exact paths and prefixes of equal length the conditional location wins; regular expressions are tried in list order, and a conditional regex placed after an identical unconditional one is rejected as unreachable. See [Request conditions](docs/CUSTOM_LOCATIONS.md#request-conditions-routing-by-header-cookie-ip).
- **Rules for the whole host:** the new match type `any` (requires at least one condition) applies to every path of the Vhost and ranks like a regular expression — e.g. office network + staff cookie → `office` backends for the whole site. Combined with the 0.40.2 backend groups and per-location balancing this covers frontend-level and path-level `use_backend` rules.
- **Correctness and caching:** conditional locations are selected after the final client address and (when a condition needs it) the country are known; earlier stages and proactive cache refreshes only consider unconditional locations, and the response layer uses the finally selected location. Responses of conditional locations are never cached (`cache` must be inherit/off), so a cached unconditional response is never served to a request that matches a conditional location.
- **Panel:** each location has a **Conditions** section (source, name, operator, values one per line, NOT, ignore case), an **Add rule for the whole host** button, **↑ / ↓** buttons to order locations, condition counts in the summary and a **Test routing** panel that evaluates the unsaved draft: method, URL, client IP, country and headers → winning location, path ✓/✗ and every condition ✓/✗ for all locations, the target backend (including the consistent-hash member) and the cache bypass. English and Polish texts added.
- **Compatibility:** configurations without `conditions` or `match_type: "any"` are unchanged and serialize as before. Configurations using them are rejected by 0.40.2 and older. Glob wildcards are still not supported in paths; use regular expressions (documented).
- **Verification:** new Rust tests run 19 shared routing cases from `tests/fixtures/routing_conditions_cases.json` (exact/prefix/regex/any precedence, fall-through, every source and operator, negation, country, IPv4/IPv6 CIDR), check that conditional locations are skipped without request facts and never cached, and reject 14 invalid configurations; `tools/dev/test_routing_tester.js` runs the same cases against the panel tester. Full suite, `cargo clippy --all-targets` and `cargo fmt --check` clean. The real binary was run in headless mode against four mock origins: header, IP + cookie (whole-host rule) and POST-only routing reached the expected origins; a cacheable `/api/` response was `HIT` for plain requests while `X-Beta` requests went to the beta origin with `BYPASS / route_disabled`. In panel mode (Chrome) the tester, a new whole-host rule, reordering and saving were exercised. Not tested: production traffic, HTTP/3 clients, GeoIP-based country conditions with a real database.
## 0.40.2 — Consistent-hash balancing and per-location backend groups
- **New algorithms:** `hash` — consistent (weighted rendezvous) hash of a request key — and `random` (power of two random choices). The `hash` key is set in `load_balancing.hash`: `source` = `path` (default, path as received, before location rewrites), `uri` (path + query), `host`, `header`, `cookie`, `query` (one parameter) or `ip`; `name` for header/cookie/query; `path_depth` (hash only the first N directories); `ignore_case`; `balance_factor` (bounded load, 101–1000 %, like HAProxy `hash-balance-factor`); `fallback` algorithm for requests without the key (default `round_robin`). Hashing is always consistent: a failed, drained or removed member only moves its own keys, which return when it recovers; weights scale each member's share of keys. See [Load balancing](docs/LOAD_BALANCING.md).
- **Location backend groups (HAProxy `use_backend` style):** a Proxy location accepts `backend_ids` (a group of Vhost backends, up to 64) and `load_balancing` (`algorithm`, `hash`, `sticky`) to balance its requests differently from the rest of the Vhost — for example `\.mp3$` → `mp3_1..3` hashed by path while `/` stays on least connections. Members are shared with the Vhost pool (health, passive ejection, drain, concurrency limits, statistics), retries stay inside the group, and backends with `pool_eligible: false` serve only the locations that list them. A location affinity cookie is named `<vhost cookie>__<location>`; the Vhost and its locations strip each other's affinity cookies before forwarding.
- **Panel:** the Vhost **Balancing** section and a new **Backends & balancing** section per location offer the new algorithms with a one-line explanation each, *Quick setup* buttons (files by path, session cookie, tenant header, query parameter, client IP, even load), the equivalent HAProxy lines, a backend-group picker and **Test distribution** — an in-browser simulator on the unsaved draft that shows the hash key and backend per sample, the share per backend and which keys move when a backend is marked as failed. It ranks backends with the same SHA-256 rendezvous scoring as the proxy (`tools/dev/test_balance_simulator.js` checks it against the Rust reference vectors). English and Polish texts added.
- **Compatibility:** configurations without the new fields are unchanged and still serialize without them; `ip_hash` keeps the same client → backend mapping. Configurations using `hash`, `random`, `backend_ids` or location `load_balancing` are rejected by 0.40.1 and older. `backend_id` (pinned backend) cannot be combined with a group or location balancing. OpenAPI, Vhost/location/headless guides and the feature list updated.
- **Verification:** 14 new unit tests (key extraction for every source, validation, stability, even spread, weight shares, only-the-failed-member's-keys move, fallback, bounded load, random, unchanged `ip_hash` mapping, location group compilation with shared member state, affinity cookie stripping, invalid groups) and the Node simulator test; full suite (1043 library tests, 7 CLI tests), `cargo clippy --all-targets` and `cargo fmt --check` clean. The real binary was run in headless mode with the `.mp3` example above against four mock origins: 61 paths were spread over `mp3_1..3` and stayed stable over repeated requests, `/` stayed on `app`, a header-hashed location kept tenants stable and used round robin without the header; stopping `mp3_2` moved exactly its 27 keys (all others stayed), and after it came back every key returned to its original backend. In panel mode (Chrome) the editors, presets, simulator and failure simulation were used on a saved Vhost and a new location group was created and saved through the UI. Not tested: production traffic, HTTP/3 clients and multi-node deployments.
## 0.40.1 — Forced certificate renewal (panel and headless)
- **Panel — Force renewal now:** each managed ACME certificate in **Certificates → Automatic renewal** has a new action next to *Check now* and *Validate renewal (dry run)*. It runs `certbot renew --force-renewal` for that profile, so a new certificate is requested even if the current one is not due (key compromise, CA revocation, chain change). A confirmation explains the CA rate limits; the current certificate stays active until the new pair is validated and deployed. The job kind is `renewal-forced`, the audit action `acme.renew_forced`; if Certbot returns the installed pair unchanged the result is `acme.force_unchanged`.