v0.42.3
This commit is contained in:
1 parent
a75893d428
commit
bfbeedfad7
43 files changed
+5834
-125
No files matched your search
@@ -0,0 +1,47 @@
|
||||
# Error pages: built-in, Cloudflare-style and custom
|
||||
|
||||
From **RustProxy 0.42.3**, administrators can choose a **Cloudflare-style (offline)** page alongside the existing built-in, blank, placeholder and custom HTML responses. This does not turn Cloudflare into an upstream or contact its servers.
|
||||
|
||||
## Where to select a page
|
||||
|
||||
- **Settings → Pages:** select `Cloudflare-style (offline)` for an individual HTTP error code, or for the direct-IP and unknown-host response. **Switch all to Cloudflare style** sets both host-level pages plus all 11 configurable global error codes in the **draft**. Select **Validate, save and apply** to publish. This does not rewrite any per-Vhost overrides.
|
||||
- **Vhost → Pages:** select it for a custom error response or a missing-path fallback. **Switch all to Cloudflare style** changes response, fallback and all 11 supported error codes for **this Vhost**; it also enables application-error interception for those codes so origin 4xx/5xx responses use the selected pages. **Validate, save and apply** saves the Vhost. The button does not change other Vhosts.
|
||||
- **404 hosts → Response type:** choose `Cloudflare-style (offline)` and a supported error status.
|
||||
|
||||
Existing configuration stays unchanged until an administrator explicitly selects a template or uses the new bulk button and saves. A bulk button changes only the current form draft; it does not save automatically. The per-Vhost bulk action intentionally enables interception of supported origin errors for that Vhost. A per-Vhost page takes precedence over the corresponding global error page. Authorization provider responses/redirects remain protected by the existing authentication flow.
|
||||
|
||||
## Supported pages
|
||||
|
||||
The directory `src/admin/web/cf_page/` contains generated HTML files for `200, 400, 401, 403, 404, 408, 410, 413, 429, 500, 502, 503, 504`. Global error replacement supports `400, 401, 403, 404, 408, 413, 429, 500, 502, 503, 504`; other supported statuses apply to local responses/404 hosts where relevant. An unsupported standalone status displays RustProxy's normal built-in response.
|
||||
|
||||
Each page contains the corresponding HTTP code, heading, three-node diagnostic visualization and short next-step advice. The layout follows the familiar light header, gray status band, green/red indicators and two help columns of the [cloudflare-error-page](https://github.com/donlon/cloudflare-error-page) reference project, with a dedicated **RP** mark instead of Cloudflare's cloud. The static HTML contains no Cloudflare links, logos, Ray IDs, fake origin-health checks, or service-ownership claims. Status icons describe the request's handling, not actual live health telemetry. The footer uses minimal **RustProxy** branding instead of a lengthy disclaimer.
|
||||
|
||||
## How it works
|
||||
|
||||
`src/pages/mod.rs` uses `include_str!` references to the pre-generated HTML files, **exactly like the existing `src/admin/web/error_*.html` templates**. HTML and CSS are contained in each file. There are no external fonts, images or scripts, no network requests, no runtime filesystem reads and no newly introduced binary/static-file server.
|
||||
|
||||
Existing status overrides in the form are preserved by the bulk action; choosing a page style does not silently change the HTTP status. The original HTTP status is preserved for intercepted errors. Served pages have `Content-Type: text/html; charset=utf-8`, `Cache-Control: no-store`, and `X-Content-Type-Options: nosniff`. Existing challenge headers (such as `WWW-Authenticate`) are retained. Invalid page combinations are rejected during config validation. Edits to embedded templates require rebuilding RustProxy, while switching the selected page kind is a normal live configuration change.
|
||||
|
||||
## Example JSON
|
||||
|
||||
Select the template for one global HTTP status without changing other error pages:
|
||||
|
||||
```json
|
||||
{
|
||||
"pages": {
|
||||
"errors": {
|
||||
"502": { "kind": "cloudflare", "status": null, "html": "" }
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
This is a fragment of configuration, not a complete replacement document. In the panel, set **Settings → Pages → 502 → Cloudflare-style (offline)** and save the section.
|
||||
|
||||
## Verification
|
||||
|
||||
```sh
|
||||
curl -i https://your-host.example/nonexistent
|
||||
```
|
||||
|
||||
Check the actual HTTP status and response markup. For a 502 page, first configure interception or a matching generated error, then confirm the body shows `502 Bad gateway` and `RustProxy`. Re-test `401` with Basic Auth to ensure the challenge header remains. No Cloudflare account or public network access is needed.
|
||||
Reference in new issue
Block a user