This commit is contained in:
Mateusz Gruszczyński committed 2026-11-21 14:03:29 +01:00
1 parent 3b5fc8dce1
commit 748fe1d146
23 files changed
+2901 -40

No files matched your search

+16
View File
@@ -2,6 +2,22 @@
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.40.0 — Headless HTTPS, automatic certificates, routes without a file and watch
All additions are headless-only and optional; without them headless and panel mode behave as in 0.39.2. See [Headless mode](docs/HEADLESS.md#https-certificate-files-and-automatic-certificates).
- **`"headless"` section in the JSON file:** a top-level object with `tls`, `acme` and `watch`, read only in headless mode and removed before the rest of the file is parsed, so the configuration format itself is unchanged. Relative paths are relative to the file. Every setting also exists as a command-line option and `RUST_PROXY_*` environment variable; lists are joined, single values from the command line win, switches are on if either place enables them. Changes apply with the next reload (`watch` at start). New examples: `examples/headless-https-files.json`, `examples/headless-acme.json`, `examples/headless-acme-wildcard-dns.json`, `examples/headless.environment`.
- **Certificate files:** `headless.tls.certificates` / `--tls-cert-file` + `--tls-key-file` and `headless.tls.directories` / `--tls-cert-dir`. A directory is scanned on every start and reload: one lineage (`fullchain.pem` + `privkey.pem`), Certbot `live/<name>/`, acme.sh `<name>/fullchain.cer` + `<name>/<name>.key`, or flat `<name>.crt|pem|cer` + `<name>.key`. Certificates get stable ids `hl-file-…`; SNI selection uses the certificate SAN, so no `certificate_id` is needed. An id that also appears in the file is rejected instead of overridden.
- **Automatic DV certificates:** `headless.acme` / `--acme-domains`, `--acme-email`, `--acme-agree-tos` (required consent), `--acme-staging`, `--acme-provider http01|cloudflare|ovh|rfc2136`, `--acme-dns-credentials` (Certbot plugin INI, mode `0600`, read per request), `--acme-propagation-seconds`, `--acme-renew-days` (default 30). A background task issues missing or changed certificates a few seconds after start and after every reload, checks every 12 hours and renews before expiry, one request at a time, through the existing Certbot worker (managed runtime, HTTP-01 responder before vhost routing, per-certificate Certbot profile). Results are recorded in `<data-dir>/certs/headless-acme.json` and activated by an internal reload without dropping connections or the cache; the previous generation is removed. Wildcards require DNS-01. Failures are logged with the Certbot log path and retried with back-off (10 min … 12 h). Default CA: Let's Encrypt production.
- **`acme.auto` / `--acme-auto` (Traefik certificate resolver):** one certificate per vhost for every host of enabled vhosts and redirects that no other certificate covers (`*`, IPs, single labels and — with HTTP-01 — wildcards are skipped; at most 64 automatic certificates). When hosts change, the replacement is issued first and the old certificate removed only after its served names are covered; certificates of removed hosts are deleted.
- **`--route HOSTS=URLS` (quick start):** a vhost per option (environment `RUST_PROXY_ROUTES`, `;` between routes) with WebSockets, `X-Forwarded-For` and up to 32 backends (same defaults as a vhost in the file); `--force-https` redirects these vhosts to HTTPS (308). With routes, `--config` becomes optional; `reload` works without a file. Routes are added to the file's vhosts when both are given.
- **`watch` / `--watch` (Traefik file provider):** polls the configuration file, certificate files and certificate directories (following Certbot links) every 2 s and reloads after a change has been stable for one more check. Invalid files are rejected and logged; the running configuration stays active.
- **`/certificates` on `--health-listen` (Envoy admin style):** read-only list of active certificates with source (`configuration`, `file`, `acme`, `acme-auto`), names, issuer and expiry, plus the state of each headless ACME request (`valid`, `issuing`, `waiting`, `failed`, last error, next check).
- **Startup checks:** the new options are refused in panel mode; unpaired certificate/key files, invalid routes, wildcards with HTTP-01, a missing e-mail, consent or DNS credentials and group/world-readable credential files fail at start (or reject a reload). Warnings are logged when certificates are configured without an HTTPS listener or HTTP-01 is used without a plain HTTP listener. `rust-proxy --headless config validate` accepts the same options and reports routes, certificates, ACME and watch.
- **Docs:** headless guide rewritten for HTTPS with JSON and command-line variants side by side and a Traefik/Envoy → RustProxy mapping (most Envoy traffic features — weights, backup/drain, passive health/outlier ejection, retries, `max_concurrent_requests` + queue as circuit breaker, slow start, sticky — already existed).
- **Compatibility:** configuration format (outside the optional `"headless"` object), API and panel behaviour are unchanged. Certificates in the file with `issuer.auto_renew` remain refused in headless mode.
- **Verification:** 16 headless unit tests (name parsing, ids, option validation and merging, the `"headless"` section, directory layouts, ACME state, DNS credentials, routes, `auto` host selection, examples) plus the full suite; `cargo clippy --all-targets` and `cargo fmt --check` clean. The real binary was exercised end to end: file certificates with SNI by SAN and rotation by `reload` and by `watch`; Certbot `live/` symlinks; explicit ACME issue → renewal → not-due; routes-only start with `--force-https` and `--acme-auto`; `auto` issuing for an added vhost, re-issuing after a host change and deleting the certificate of a removed vhost via `watch`; an invalid file rejected by `watch`; `/certificates`; previous headless setups unchanged. ACME runs used a stub `certbot` with HTTP-01 challenges answered by RustProxy; issuance from a real CA (Let's Encrypt staging) was not tested in this environment.
## 0.39.2 — Central cache decision and public static assets for logged-in users
- **Static assets for logged-in users:** fixed public CSS/JS/images/fonts getting `BYPASS / cache_rule` as soon as a browser carried a session cookie. Root cause: a request-stage `pass` from a session/Cookie rule disabled the cache in `route_cache.rs` before the static-cookie options (`static_ignore_cookies`, `static_ignore_vary_cookie`) were consulted. Added a central decision (`cache::request_gate`, `static_cookie_guard_relaxation`, `shared_static_response_reason`) with fixed precedence: security, configuration, explicit VCL `pass`, VCL Cookie guard, default request policy, backend response. New request action `cookie_pass` (VCL `return(cookie_pass)`, RustProxy extension) marks Cookie/session guards; it is relaxed only for GET/HEAD static-extension requests without `Authorization` when no other rule would bypass the request with guards removed or without cookies. Explicit `pass` is never relaxed and existing configurations are not rewritten; the rules editor offers **Convert to Cookie guard** for Cookie-only `pass` rules. Session, framework and CDN remaining-cookie templates now insert `cookie_pass` (WordPress/WooCommerce split into a path `pass` and a Cookie guard). A static fill whose Cookie is ignored in the key is stored only if the original backend reply is 200, explicitly public (`public`, `s-maxage`, `max-age>0` or future `Expires`), not HTML/XHTML and has no `Set-Cookie`, `private`, `no-store`, `Vary: *` or `Vary: Authorization` — evaluated before response rules, so `strip_set_cookie`/`ignore_cache_control` cannot share a private reply; such fills are refreshed proactively without the client Cookie. New reason codes `cache_rule_cookie`, `cache_miss_static_cookie`, `response_static_not_public`, `response_static_dynamic`; header names and formats are unchanged. **Test a request** uses the same decision and reports `reason_class`, `static_cookie_relaxed` and `shared_static_check`. Downgrading to 0.39.1 or older requires converting `cookie_pass` rules back to `pass`. Unit and proxy integration tests cover the regression matrix (anonymous/session CSS, Drupal 6 JS with query, fonts, `Vary: Cookie` + `Accept-Encoding` variants, HTML, private routes, Authorization, private/Set-Cookie/HTML/unproven statics, explicit pass, GET/HEAD, options off).