# Custom page settings

> Platform versions: this page applies to API v4.x only, not to API v3.x.
> Equivalent page for API v3.x: [Error Responses](/en/documentation/platform/custom-pages/error-responses.md)

[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. A custom page set is the named list that groups those pages. A [Workload](/en/documentation/platform/workloads/) uses a custom page set only once that Workload's deployment sets that custom page set. For the deployment fields, refer to [Workload settings](/en/documentation/platform/workloads/settings/#deployment).

---

## Interfaces

Three interfaces write a custom page set, and a Workload's deployment sets it. The tables on this page name the Console control and the API field of each setting.

| Interface                                                                    | Create                                                                             | Read, update, delete                                                                                                             |
| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| [Azion Console](https://console.azion.com/)                                  | The **Custom Pages** menu at `/custom-pages`, then the **Create Custom Page** page | The **Edit Custom Page** page                                                                                                    |
| [Azion API v4](https://api.azion.com/v4#/operations/GetWorkspaceCustomPages) | `POST /v4/workspace/custom_pages`                                                  | `GET`, `PUT`, `PATCH`, and `DELETE /v4/workspace/custom_pages/{custom_page_id}`; `GET /v4/workspace/custom_pages` lists the sets |
| Azion CLI                                                                    | `azion create custom-pages --file`                                                 | `azion describe custom-pages --custom-page-id` and `azion list custom-pages`                                                     |

The CLI reads every field of the set from the JSON file of `--file`. In Azion Console, you assign a set in the **Custom Page** field of the Workload's **Deployment Settings** section.

Assigning a set is a change to the Workload's deployment, and that change reaches the data centers over several minutes, with no guaranteed time. For more information, refer to [How Custom Pages works](/en/documentation/platform/custom-pages/how-it-works/#the-deployment) and [Propagation](/en/documentation/platform/workloads/how-it-works/#propagation).

On API v4, **Custom Pages** takes the place of Error Responses, the error page settings of an Application on API v3. Each v3 field has a v4 counterpart:

| Error Responses field, API v3 | Custom Pages field, API v4                            |
| ----------------------------- | ----------------------------------------------------- |
| Status Code                   | **Page Code**, `code`                                 |
| Error Caching TTL             | **Response TTL**, `ttl`                               |
| URI                           | **Page Path (URI)**, `uri`                            |
| Custom Status Code            | **Response Custom Status Code**, `custom_status_code` |

The two models locate the page file differently. A v3 URI is appended to the Application's domain and fetched from the origin that the **Set Origin** field sets. A v4 `uri` is fetched from the Connector of the page. For an Application that still runs on API v3, refer to [Error Responses](/en/documentation/platform/custom-pages/error-responses/).

---

## Custom page set fields

A custom page set is a named list of pages. The API requires `name` and `pages`, and the other fields are read-only, except `active`. In Azion Console, the **Create Custom Page** page reads: "Create custom pages to handle errors and cache TTL based on the HTTP status code received from the Connectors."

| Console control      | API field         | Type                  | Values                                                                                                                                | Default              |
| -------------------- | ----------------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | -------------------- |
| none                 | `id`              | integer               | assigned by Azion, read-only                                                                                                          | none                 |
| **Name**             | `name`            | string                | 1 to 255 characters                                                                                                                   | required, no default |
| **Active**           | `active`          | boolean               | `true`, `false`                                                                                                                       | `true`               |
| **Page Codes** table | `pages`           | array of page objects | at least one page, each described in Page fields                                                                                      | required, no default |
| none                 | `last_editor`     | string                | the email of the last user who changed the set, read-only                                                                             | none                 |
| none                 | `last_modified`   | string, date-time     | read-only                                                                                                                             | none                 |
| none                 | `created_at`      | string, date-time     | read-only                                                                                                                             | none                 |
| none                 | `product_version` | string                | read-only                                                                                                                             | `1.0`                |
| none                 | `is_versioned`    | boolean               | read-only; `false` on an account without versioning                                                                                   | none                 |
| none                 | `version`         | nullable              | read-only; `null` on an account without versioning                                                                                    | none                 |
| none                 | `version_id`      | nullable              | read-only; the ID of the version metadata; `null` on an account without versioning                                                    | none                 |
| none                 | `version_state`   | nullable              | read-only; the build state of the version, such as `queued`, `building`, `ready`, or `error`; `null` on an account without versioning | none                 |

In Azion Console, the help text of **Name** reads "Give a unique and descriptive name to identify the custom page." The **Page Codes** table lists one row per page, with the columns **Page Status Code**, **Page Path (URI)**, **Custom Status Code**, and **Response TTL**. A set with no page is refused, in the API and in the Console.

---

## Page fields

Each entry of `pages` assigns one page to one status code. A page of the `page_connector` type sets a Connector and the path of the page's content on that Connector. It also sets the page's cache time and an optional status code for the response. In Azion Console, these fields sit in the **Status Configuration** and **Response Details** sections of a page.

| Console control                 | API field                            | Type               | Values                                                         | Default              |
| ------------------------------- | ------------------------------------ | ------------------ | -------------------------------------------------------------- | -------------------- |
| **Page Code**                   | `code`                               | string             | `default` or one of the codes in Status codes, such as `"404"` | required, no default |
| *Page Connector*                | `page.type`                          | string             | `page_connector`                                               | `page_connector`     |
| **Connector**                   | `page.attributes.connector`          | integer            | the ID of a Connector                                          | required, no default |
| **Response TTL**                | `page.attributes.ttl`                | integer, seconds   | 0 to 31,536,000                                                | `0`                  |
| **Page Path (URI)**             | `page.attributes.uri`                | string, or `null`  | 1 to 250 characters                                            | none                 |
| **Response Custom Status Code** | `page.attributes.custom_status_code` | integer, or `null` | 100 to 599                                                     | none                 |

A page acts on the status code that a Connector returns to Azion. When that code has a page in the set, the client receives the page's content in place of the response, with no redirect. Azion Console offers two page types, *Page Connector* and *Page Default*. With *Page Default*, the Console shows the **Content Type** and **Response** fields instead of the Connector fields, and the API has no documented shape for that type.

`page.attributes.uri` is the path from which the page's Connector delivers the content. For example, with the path `/myerrors/505.html` and a Connector whose address is `myconnector.azion.com`, Azion fetches and delivers the content from `myconnector.azion.com/myerrors/505.html`.

`page.attributes.ttl` sets the time to live (TTL) of the error page: its cache time, in seconds. For the expiration settings of an Application's own cache, refer to [Cache settings](/en/documentation/platform/applications/cache/cache-settings/#browser-cache).

`page.attributes.custom_status_code` is the status code the client receives instead of the original one. For example, a page with `code` set to `"403"` and `custom_status_code` set to `404` answers a `403` from the Connector with a `404`.

---

## Status codes

The `code` field takes 22 HTTP status codes: 16 client errors (4xx) and six server errors (5xx). It also accepts `default`, which the Console lists as *Default*. For a code with no page of its own, the **Page Codes** help text reads: "Codes tagged Azion serve the default Azion page; setting a custom page for one of them replaces it." The table describes what each code means when the Connector returns it.

| `code` | Status                          | What the Connector response means                                                             |
| ------ | ------------------------------- | --------------------------------------------------------------------------------------------- |
| `400`  | Bad Request                     | The request has invalid parameters or lacks required ones.                                    |
| `401`  | Unauthorized                    | The request lacks the authentication header the server requires.                              |
| `403`  | Forbidden                       | The user has no permission to run the operation.                                              |
| `404`  | Not Found                       | The requested resource does not exist.                                                        |
| `405`  | Method Not Allowed              | The request method cannot be applied to the URL.                                              |
| `406`  | Not Acceptable                  | The `Accept` header is missing, or asks for an unsupported format or version.                 |
| `408`  | Request Timeout                 | The server timed out waiting for the request and wants to close the connection.               |
| `409`  | Conflict                        | The request conflicts with the server's state, such as creating a record that already exists. |
| `410`  | Gone                            | The content was deleted from the server permanently, with no redirect address.                |
| `411`  | Length Required                 | The server requires a `Content-Length` header, and the request has none.                      |
| `414`  | URI Too Long                    | The requested URI is longer than the server accepts.                                          |
| `415`  | Unsupported Media Type          | The server does not support the media format of the request data.                             |
| `416`  | Range Not Satisfiable           | The `Range` header asks for data that the target URI does not have.                           |
| `426`  | Upgrade Required                | The server accepts the request only after the client changes protocol.                        |
| `429`  | Too Many Requests               | The client exceeded an operation limit and must wait before it tries again.                   |
| `431`  | Request Header Fields Too Large | The request headers are too long, or the request sends too many cookies.                      |
| `500`  | Internal Server Error           | An unexpected fault occurred while the server processed the request.                          |
| `501`  | Not Implemented                 | The server does not support the request method.                                               |
| `502`  | Bad Gateway                     | The server, acting as a gateway, received an invalid response while it handled the request.   |
| `503`  | Service Unavailable             | The server is overloaded or under maintenance and cannot handle the request yet.              |
| `504`  | Gateway Timeout                 | The server, acting as a gateway, did not receive a response in time.                          |
| `505`  | HTTP Version Not Supported      | The server does not support the HTTP version of the request.                                  |

Six of the codes carry more detail:

- **`408`**: some browsers, such as Chrome, Firefox 27+, and IE9, open connections in advance to speed up navigation, which makes this response common. Some servers close the connection without sending it.
- **`410`**: caches and links to the content should be removed. The HTTP specification describes `410` for limited promotional services, and an API should not use it to say which resources were removed.
- **`426`**: the `Upgrade` header of the response names the protocols the server requires.
- **`429`**: the server refuses requests from the client for a time.
- **`501`**: servers must support `GET` and `HEAD`, so they do not return `501` for those two methods.
- **`503`**: the code marks a temporary condition. The response should explain the problem and carry a `Retry-After` header with the estimated recovery time, and it is not normally cached.

---

## Request body

A request body with one page creates a set that replaces a `404` from the Connector. The page serves the document at the path `/html` on its Connector, with status `404`. The same body works for `POST /v4/workspace/custom_pages` and for the file of `azion create custom-pages --file`:

```json
{
  "name": "my-custom-pages",
  "active": true,
  "pages": [
    {
      "code": "404",
      "page": {
        "type": "page_connector",
        "attributes": {
          "connector": <connector-id>,
          "ttl": 0,
          "uri": "/html",
          "custom_status_code": 404
        }
      }
    }
  ]
}
```

Send it with the CLI, with the body saved as `cp.json`:

```bash
azion create custom-pages --file cp.json
```

The command prints the ID of the new set:

```text
Created Custom Page with ID <custom-page-id>
```

`azion list custom-pages --details` lists the set:

```text
ID   NAME                  ACTIVE  LAST EDITOR             LAST MODIFIED                         
<custom-page-id>  my-custom-pages  true    <your-email>  2026-01-01 12:00:00.000000 +0000 UTC  
```

`azion describe custom-pages --custom-page-id <custom-page-id> --format json` returns the set as the API stores it, with every page attribute as sent:

```json
{
  "active": true,
  "created_at": "2026-01-01T12:00:00.00000Z",
  "id": <custom-page-id>,
  "is_versioned": false,
  "last_editor": "<your-email>",
  "last_modified": "2026-01-01T12:00:00.000000Z",
  "name": "my-custom-pages",
  "pages": [
    {
      "code": "404",
      "page": {
        "attributes": {
          "connector": <connector-id>,
          "custom_status_code": 404,
          "ttl": 0,
          "uri": "/html"
        },
        "type": "page_connector"
      }
    }
  ],
  "product_version": "1.0",
  "version": null,
  "version_id": null,
  "version_state": null
}
```

A Workload uses a custom page set only once that Workload's deployment sets that custom page set. In Azion Console, that is the **Custom Page** field of **Deployment Settings**.

After the deployment propagates, a request that the Connector answers with `404` receives the page's content in place of that response. The response keeps status `404`, from `custom_status_code`, and carries no `Location` header, so the client is not redirected. In the command, `<missing-path>` is a path that the Connector answers with `404`:

```bash
curl -s -D - https://<workload-domain>/<missing-path>
```

The response starts with the status line and the document from the `/html` path on the page's Connector, as in this example:

```text
HTTP/2 404 
content-type: text/html; charset=utf-8

<!DOCTYPE html>
<html>
  <head>
  </head>
  <body>
      <h1>Page not found</h1>
```

---

## Errors

The API refuses a set with an empty `pages` list, and the Console refuses to save one. The CLI prints the API message inside `Error: Failed to create Custom Page: [...]`, followed by `Check your settings and try again. If the error persists, contact Azion support`.

| Message                                       | Cause                                                     | What to do                               |
| --------------------------------------------- | --------------------------------------------------------- | ---------------------------------------- |
| `Ensure this field has at least 1 elements.`  | The request sends `"pages": []`.                          | Add at least one page to `pages`.        |
| `You must have at least one custom page code` | The Console form has no page in the **Page Codes** table. | Add a page code before you save the set. |

---

## Related resources

- [How Custom Pages works](/en/documentation/platform/custom-pages/how-it-works.md): How a page replaces an error response, which codes receive Azion's default error page, and how an assigned set propagates.
- [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.
- [Custom Pages limits](/en/documentation/platform/custom-pages/limits.md): The scope of Custom Pages, the minimum page count of a set, and the range of each field on this page.
- [Troubleshoot Custom Pages](/en/documentation/platform/custom-pages/troubleshooting.md): The fix for a set refused with no page, and for an error page that does not reach the client.
