# Error pages: built-in, Cloudflare-style and custom RustProxy 0.42.3 offers three **Cloudflare-style (offline)** designs alongside the existing built-in, blank, welcome and custom HTML responses: status-specific, congratulations and placeholder. 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 a Cloudflare-style status page, welcome page or placeholder and a supported error status. The standalone 404 host remains restricted to error HTTP statuses. The two new designs are also selectable in Settings → Pages and Vhost → Pages. They show a welcome or placeholder message without implying an HTTP success/error code; the actual HTTP status remains independently configurable. 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 `welcome.html`, `placeholder.html` and generated status 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. Status-specific pages contain one visible HTTP code in the heading: `HTTP 200` for success, or `Error 504` (for example) for errors. The welcome and placeholder pages have their own headings and advice without a fixed code in the HTML. All contain a three-node diagnostic visualization and short next-step advice. HTTP 204 No Content must use empty mode and never returns an HTML body. 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 the official RustProxy favicon embedded as an inline SVG 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 when enabling the bulk action, including empty HTTP 204 responses. Already styled pages retain their selected variant; existing welcome pages are converted to the styled welcome or placeholder according to their scope. Turning the switch off clears the overrides as before. 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. For a welcome or placeholder response use `"kind": "cloudflare_welcome"` or `"kind": "cloudflare_placeholder"` in the same Page object. Use `"kind": "empty", "status": 204` for a no-content response. ## 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 `Bad gateway Error 502` and `RustProxy`. Re-test `401` with Basic Auth to ensure the configured Vhost/global HTML is returned while `WWW-Authenticate` and `Cache-Control: private, no-store` remain. PHP/FastCGI and `.htaccess ErrorDocument` error bodies remain application-controlled unless explicitly listed in Vhost `intercept_statuses`; generated Web Server errors use configured error pages without enabling interception. No Cloudflare account or public network access is needed.