# How Custom Pages works

When an origin cannot find a resource, or does not respond in time, the client receives an error response, such as `404` or `504`. A custom page replaces that response with content you choose.

[Custom Pages](/en/documentation/platform/custom-pages/) is a Platform Resource that replaces the error response returned by a [Connector](/en/documentation/platform/connectors/) with a page of your own, one page per error status code. On API v4, Custom Pages takes the place of Error Responses, the error page settings of an Application on API v3. For an Application that still runs on API v3, refer to [Error Responses](/en/documentation/platform/custom-pages/error-responses/).

This page covers the mechanisms rather than the fields: every field is on [Custom page settings](/en/documentation/platform/custom-pages/settings/), and every bound is on [Custom Pages limits](/en/documentation/platform/custom-pages/limits/). For the path of a request through Custom Pages, with a diagram, refer to [Request path](/en/documentation/platform/custom-pages/#request-path). The sections cover, in order, error responses, custom pages and custom page sets, page content from a Connector, the status codes a page can replace, Azion's default error page, and the deployment.

---

## Error responses

An error response carries a status code that says the request failed: a client error (4xx) or a server error (5xx). On Azion, the Application sends a request to the origin through a Connector, and the Connector answers with a status code. A custom page acts after the Application receives that response, and the status code decides whether a page applies.

---

## Custom pages and custom page sets

A custom page replaces the error response for one status code, and a custom page set is the named list that groups those pages. When the Connector answers with a status code, Azion looks for a page with that code in the custom page set that the [Workload](/en/documentation/platform/workloads/)'s deployment sets. Each page acts only on the status code it lists, such as `"404"`, so a set holds one page for each code it replaces.

When a page matches, the client receives the page's content in place of the response. The response carries no redirect and no `Location` header, so the browser stays on the URL it requested. A set holds at least one page, as [Custom Pages limits](/en/documentation/platform/custom-pages/limits/) states.

---

## Page content from a Connector

A page of the `page_connector` type sets a Connector and the path of the page's content on that Connector. Azion fetches the content from the page's Connector at the page's `uri`. The page's `ttl` sets the cache time of that content. A page can also set `custom_status_code`, the status code the client receives instead of the original one.

For example, your origin answers a deleted product page with `404`. A page for the code `404` then serves the document at its `uri`, such as `/myerrors/404.html`, still with status `404`, and the browser shows your page.

For the type and the default of each field, refer to [Page fields](/en/documentation/platform/custom-pages/settings/#page-fields).

---

## Status codes a page can replace

A page can replace only a status code from a fixed list of 22 codes: 16 client errors (4xx) and six server errors (5xx). For each code in the list and what it means when the Connector returns it, refer to [Status codes](/en/documentation/platform/custom-pages/settings/#status-codes).

---

## Azion's default error page

When the custom page set has no page for a status code, the client receives the Connector's response unchanged. Eight codes are the exception: `400`, `401`, `403`, `406`, `500`, `502`, `503`, and `504` receive Azion's default error page instead. A page for one of those eight codes replaces Azion's default error page with yours.

For example, a set that holds only a `404` page answers a `502` from the Connector with Azion's default error page, not with the origin's response. A Workload whose deployment sets no custom page set passes every response unchanged.

---

## The deployment

A [Workload](/en/documentation/platform/workloads/) uses a custom page set only once that Workload's deployment sets that custom page set. A Workload holds at most one deployment, so one custom page set covers every hostname of the Workload. For the deployment fields, refer to [Workload settings](/en/documentation/platform/workloads/settings/#deployment).

Assigning a set is a change to the Workload's deployment, and that change propagates. It spreads across Azion's distributed infrastructure, data center by data center, over several minutes. Meanwhile, requests can receive the previous or the updated configuration, depending on the data center that answers. For that reason, Azion does not guarantee when an assigned set starts to serve, as [Propagation](/en/documentation/platform/workloads/how-it-works/#propagation) explains.

To set the custom page set in the deployment, refer to [Customize an error page](/en/documentation/guides/application-development/getting-started/customizing-error-response-page/#assign-the-set-in-the-workloads-deployment).

---

## Related resources

- [Custom page settings](/en/documentation/platform/custom-pages/settings.md): Every field of a custom page set and its pages, the 22 status codes a page can replace, and a request body to copy.
- [Custom Pages quickstart](/en/documentation/platform/custom-pages/quickstart.md): Create a custom page set, assign it in a Workload's deployment, and see a page replace your origin's 404.
- [Customize an error page](/en/documentation/guides/application-development/getting-started/customizing-error-response-page.md): Replace the error responses of several status codes at once, each page with its own cache time.
- [Troubleshoot Custom Pages](/en/documentation/platform/custom-pages/troubleshooting.md): Find the cause when a custom page set is refused or an error page does not reach the client.
