How to set error pages

Configure your edge application to handle error responses from the origin using Error Responses. Azion allows you to set a cache TTL for error pages, a custom path, or deliver another HTTP code in the response without needing to change the source code of your application.

With this guide, you’ll modify the default error response of your application, setting a cache TTL for each error received from the origin.

  1. Access Azion Console.
  2. On the upper-left corner of the page, open the Products menu, represented by three horizontal lines, and select Edge Application.
  3. Click the edge application you want to configure.
  4. Select the Error Responses tab.

In the Error Responses section, the Status Code field can’t be modified. This field represents every error status code received from the origin. The Error Caching TTL (seconds) field below it allows you to customize the cache TTL for every status code received.

  1. Under Error Caching TTL (seconds), set the cache time-to-live (TTL), in seconds, for all error pages.
  2. Click the + button.
  3. In the new Status Code field, select the status code you want to customize. For example: 404.
  4. Add a cache TTL in the Error Caching TTL (seconds) field.

You can also determine a specific path from your origin that will be delivered to the user and a custom status code in the response. These modifications are optional.

  1. In the URI field, add a path to an error page created in the source. For example: /error/404.
  2. In the Custom Status Code field, customize the HTTP status that’ll be received by the user.
  3. In the Origin section, select the origin of error page URIs.
  4. Click the Save button.

When errors are received from the origin, your edge application will cache and display the error page based on the new configuration.