Error Pages — custom error pages
This section uses an On/Off switch in the top corner. Off = delete all of the domain's custom error pages → back to the default error pages.
Error Pages (custom error pages) let you replace the default error page with your own HTML for each HTTP error code (4xx/5xx). When the edge returns an error code you have configured, it renders your HTML page (with dynamic tokens such as the error code, reason, time… substituted) instead of the default page.
Use this when: you want to keep your brand identity and show a friendly message when something goes wrong. Example: when the origin is down (502) or overloaded (503), visitors see a "We'll be right back" page with your logo instead of a blank page.
Before you start
- The domain has been added and points to VNIS.
- You have (or will write) the HTML for the error page.
How to configure
This section uses an On/Off switch in the top corner: On = create and apply the custom error pages (saved immediately); Off = delete all custom error pages → back to the default pages. The list of pages is shown even when Off — write them first, then switch On.
- Go to Domains → select the domain → Error Pages tab.

- Choose an error code from the dropdown (for example
502) to add a page. - Paste/write the HTML; use the Preview iframe to try it out. You can insert tokens such as
{code},{reason}(see Configuration fields). - Turn on the On switch in the top corner of the section. For later changes, click Save (shown only when On and there are unsaved changes).
Simple HTML example for code 502:
<h1>{code} — {reason}</h1>
<p>The service is busy. Please try again in a few minutes.</p>
<small>Request ID: {request_id} · {time}</small>
Configuration fields
| Field | Meaning | Values | Default | Notes |
|---|---|---|---|---|
| On/Off switch (corner of the section) | Turns all custom error pages on/off — On = creates, Off = deletes | Switch | Off (not configured) | Off = deletes all custom error pages → the default pages are used; to turn it back on, you have to write the pages again |
| Pages (map of error code → HTML) | HTML content for each code | Each key is a code 400–599 (the dropdown in the interface only lists 21 preset codes: 400, 401, 403, 404, 405, 406, 408, 410, 413, 415, 429, 451, 500, 502, 503, 504, 520–524) | — | Invalid key (for example 399, 600 or letters) → error 400. Each page applies only to that exact code (configuring 502 does not automatically apply to 503) |
Dynamic tokens (substituted by the edge at render time; all are HTML-escaped to prevent XSS):
| Token | Meaning |
|---|---|
{code} | HTTP code (e.g. 502) |
{reason} | Standard reason phrase (e.g. Bad Gateway) |
{source} | Source of the error: Origin / VNIS / Client |
{detail} | Detailed description by error type |
{request_id} | Request ID (useful for support lookups) |
{client_ip} | Visitor's IP |
{node} | ID of the edge node that handled the request |
{time} | UTC time YYYY-MM-DD HH:MM:SS UTC |
The editor limits each HTML page to ≤ 65,536 characters. Error codes must be in the range 400–599.
Configuration examples
Example — Branded error pages for codes 502 and 404.
- Write the error pages (steps below) — you can write them even while the switch is Off.
- Add code 502 with the HTML:
<h1>{code} — {reason}</h1>
<p>The service is busy. Please try again in a few minutes.</p>
<small>Request ID: {request_id} · {time}</small>
- Add code 404 with the HTML:
<h1>Page not found</h1>
<p>The page you requested does not exist. <a href="/">Back to home</a>.</p>
- Turn on the On switch in the top corner of the section to create and apply them.
- Note: each code needs its own page (
502does not automatically apply to503). If the origin returns a 5xx with a real body, the edge keeps the origin's body. 4xx errors returned by the origin (for example the origin's 404) are passed through unchanged and are not replaced with the custom page. - Check: open in a browser a URL where the edge itself returns an error (for example blocked by WAF/Access Control → 403, or the origin cannot be reached → 502) → you see your page, with the
{request_id}token substituted.curlwithoutAccept: text/htmlreceives a short text/JSON error (add-H 'Accept: text/html'to see the custom page).
Order of evaluation
- The On/Off switch = whether the configuration exists: On = creates the error page record; Off = deletes all of the domain's custom error pages.
- Page selection order: the domain's custom page (when the switch is On and the exact code exists) → the org-level error template (Org Error Template) → the global error page → the built-in default page.
- Applies only when there is a key for the exact code. If you configure
502but a504occurs, visitors see the default page (because there is no504key). - Origin returns an error with real content: for errors returned by the origin, the edge replaces them with the custom page only when the origin returns 500/502/503/504 with
Content-Length: 0(a definitely empty body). With a body (or unknown length/chunked) → the origin's body is kept. Other origin errors (for example 404) are always passed through unchanged. - Only browsers receive the custom page: the page is used only when the request's
Acceptcontainstext/html(a browser). API clients/bots (*/*, JSON, noAccept) receive the short default error (text/JSON). - The HTML you enter is not content-filtered — only the dynamic tokens are escaped. You are responsible for the HTML body (you own the domain).
Troubleshooting
| Symptom | Common cause | Fix |
|---|---|---|
| Save returns 400 "must be a 4xx or 5xx" | The key is outside 400–599 | Use only codes 400–599 |
| Save returns 400 "invalid status code" | The key is not a number (e.g. "abc") | Enter a numeric code |
| Pages are configured but the default page still appears | The switch has not been turned On, the code that occurred differs from the configured code, or you are checking with curl/API (without Accept: text/html) | Switch On; add the exact error code you want to customize; check with a browser |
| The page does not appear even though the origin returns a 5xx/4xx | The origin returns the error with a real body, or it is a 4xx from the origin | The custom page replaces only origin 500/502/503/504 errors with an empty body — this is the correct behavior |
{code} appears literally on the page | The token was typed incorrectly (wrong brackets) | Use the correct syntax {code}, {reason}… |
FAQ
- Can one page apply to several error codes? No — each error code needs its own page (configuring
502does not automatically apply to503). - Can the
{client_ip}token be abused to inject malicious code? No — every token is HTML-escaped, so any injected content (e.g.<script>) is displayed as text and does not run. - Do I lose the content I wrote when I switch Off? Yes — Off = deletes all of the domain's custom error pages (to turn it back on, you have to write them again). If you want to keep them, copy the HTML elsewhere before switching Off; to remove one specific code, delete that page alone instead of switching the whole section Off.
- How are my error pages different from the org-level error pages? Per-domain pages (this page) have the highest precedence; if none exists, the system uses the org-level error template, then the global error page, and only then the default page.