This commit is contained in:
Mateusz Gruszczyński committed 2026-11-28 00:46:49 +01:00
1 parent 51631810e1
commit e6176cfce3
28 files changed
+959 -506

No files matched your search

+12
View File
@@ -2,6 +2,16 @@
Custom locations add exceptions to a Vhost's normal source. They are **not** required for the root path `/`: any request not matched by a custom rule continues to the Vhost's main backend pool or Web Service. Configure them under **Vhosts → Edit → Custom locations**.
## Panel layout
The list works as a routing table: each collapsed row shows its order, on/off state, ID, match type, path or conditions, the action (proxy target, Web Service, redirect or fixed response) and what it sets differently from the Vhost (access, headers, cache, own balancing, HTTP policies, error fallback). Click a row to edit it:
1. **When — match:** ID, match type, path or regular expression, *Internal named location* and optional request conditions.
2. **What — action:** proxy to a backend (one backend, the Vhost pool or a group), a Web Service, a redirect or a fixed response, plus the backend path rewrite. Only the fields of the chosen action are shown.
3. **Options:** tabs for Access (ACL profile, HTTP methods, countries, inline IP rules), Headers, Cache, Errors (error fallback), Backends & balancing and HTTP policies. A tab shows a short state when the location sets something there; empty tabs inherit the Vhost settings.
**Add location** offers starting points (path to another backend, files/PHP from a Web Service, redirect, fixed response, internal location for `error_page`, whole-host rule, empty location). They only pre-fill ordinary fields; everything stays editable. The effective behavior preview and the Up/Down/Delete actions remain at the bottom of each location. Saved JSON is identical to earlier releases.
## Path matching
| Match mode | Purpose | Priority |
@@ -91,6 +101,8 @@ Each location can add request/response header operations (`set`, `append`, `remo
Mark a location **Internal** to make it unavailable to ordinary public URI matching. A Vhost or location may direct specific origin responses (`403`, `404`, `500`, `502`, `503`, `504`) to a named internal location ID in the same Vhost. The dispatch is internal, not a browser redirect; request context and access evaluation are preserved. Invalid targets or loops are rejected.
In the panel, the Vhost **Locations** tab has an **Error fallback (error_page)** section for the main route (requests not matched by any location), and each location has the same two controls under **Options → Errors**: the fallback location (suggestions list the enabled internal locations) and a status picker. A location's fallback applies only to requests it handles; it does not inherit the Vhost-level fallback. The statuses are inactive until a fallback location is set, and at least one status stays selected.
If all you need is a different error **page body**, use **Vhost → Pages → Intercept application error responses**, which keeps the original status without making a second origin request.
## Not an Nginx configuration parser
+1 -1
View File
@@ -156,7 +156,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, compact two-section tester, *Ignore global cache rules*). **Cache & VCL guide** opens the shared modal and inserts examples into this Docker vhost's importer, never the global editor. Tests use unsaved service rules plus saved applicable global rules, unless ignored; a path-only test uses the current service hostname as `Host` when no explicit Host is provided. Unpublished service tests may lack saved vhost settings; 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. 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`. |
| **Headers** | Diagnostic headers — `Server-Timing`, the selected backend (`X-RustProxy-Backend`) and the backend time (`X-RustProxy-Backend-Time`), for testing; keep them off in production. The collapsed **HTTP policies** editor inside this section holds the assignment's policy rules (see [HTTP policies](POLICY.md)); the section summary shows the enabled headers and the rule count. 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
+8
View File
@@ -112,6 +112,14 @@ curl -Ik https://n.linuxiarz.pl/nagios/.htaccess
Expect redirects for `/` and `/nagios`, a Basic Auth challenge without credentials, a PHP/static page for `/nagios/`, FastCGI output (not CGI source code) for the CGI URL, and `403` for dotfiles (a Basic Auth challenge may happen first). A `502` suggests a missing backend/socket or bad socket permissions; a `403` can also mean the script is inaccessible/non-executable, and `404` can mean a wrong rewrite or document root. The exact Nagios page may require additional stylesheets/aliases or Nagios-specific CGI environment and permissions. Test these against a real installed Nagios, not only a mock FastCGI server.
## Connection handling
Each FastCGI request uses one new connection to the configured endpoint (no `FCGI_KEEP_CONN` pooling). A PHP-FPM worker serves one connection at a time, so keeping idle connections open would pin workers that other requests need.
- TCP endpoints are opened with `TCP_NODELAY`; the request records (`BEGIN_REQUEST`, `PARAMS`, `STDIN`) are written through a 16 KiB buffer, so a request without a body is sent in a single write. With a request body, the parameters are sent first and the body follows as it arrives from the client.
- Responses are read through a 32 KiB buffer. `STDOUT` records that have already arrived are merged into one body chunk of up to 64 KiB; RustProxy never waits for more output to fill a chunk, so `flush()` in the application still reaches the client immediately.
- The connect/request timeouts, concurrency limit, header limit and stderr limit are unchanged.
## Migrating from Nginx / Angie
| Original directive | RustProxy equivalent |
+1 -1
View File
@@ -17,7 +17,7 @@ below. VCL remains the owner of its existing cache-rule precedence and terminal
- In the panel, open **Settings → Rules & headers → HTTP policies** globally,
**Vhost → Headers → HTTP policies**, the location's **HTTP policies** section,
or the Docker assignment's policy section. The shared editor offers a rule
or **Docker Vhosts → service → Headers → HTTP policies** for a Docker assignment. The shared editor offers a rule
builder, scenario presets, a JSON view, import preview and a draft tester.
Global settings use the same editor at `settings?tab=policies`. Reordering uses
the visible rule order; switching views preserves the same policy object.