1 of 20
2 of 20
3 of 20
4 of 20
5 of 20
6 of 20
7 of 20
8 of 20
9 of 20
10 of 20
11 of 20
12 of 20
13 of 20
14 of 20
15 of 20
16 of 20
17 of 20
18 of 20
19 of 20
20 of 20


Error Responses

Error Responses is an Azion Edge Application capability that allows you to customize error pages for users based on the status code received from the origin.

  1. How it works
  2. Available error status codes
  3. Related documentation

1. How it works

When a user requests content from an edge application, Azion sends the request to origin servers. As a response, the origin sends back an HTTP status code, which indicates whether or not the request has been completed.

HTTP status codes are three-digit numbers, grouped into five categories:

  • Informational responses (1xx): the connection status or progress before completing the request.
  • Successful responses (2xx): the request was successfully received, understood, accepted, and processed by the origin.
  • Redirection messages (3xx): in order to fulfill the request, there must be a redirect.
  • Client error responses (4xx): the request couldn’t be completed due to an apparent error on the client’s side.
  • Server error responses (5xx): the server is unable to process the request.

See the specifications on HTTP status codes for more information.

With Error Responses, you can customize how your application will handle Client (4xx) and Server (5xx) error types. This way, when a request is made to a URL that can’t be found at the origin or when the server is unable to respond, the user will be redirected to a custom error page, whose contents can be cached.

To customize error responses, follow these steps:

  1. Access Real-Time Manager (RTM).
  2. Select Products menu > Edge Application.
  3. Click on the application you want to configure or build a new one.
  4. Navigate to the Error Responses tab.
  5. In the first section of the page, you can customize the caching TTL for all error responses.
  6. Click the + button to create additional error responses. See the table below for details on the available fields.
  7. After you finish filling out the fields, click the Save button.
Field Description
Status Code Code Azion receives when connecting to the origin.
Error Caching Defines the time in seconds that the error page will remain in cache before it’s refreshed.

Since an error page is often static and doesn’t change frequently, Azion recommends high value cache times. That way, you can optimize your application’s performance and reduce the cost of processing at the origin.
URI Path to the file (usually HTML) with the content of the error page that will be delivered. Example: /404.html
Custom Status Code Status code that will be delivered to the user instead of the original one. Example: 404
Set Origin The origin in which the URI file is located.

2. Available error status codes

Status Code Description
400: Bad Request Request error caused by invalid parameters, missing required parameters, or others.
401: Unauthorized Error resulting from a lack of the Authentication HTTP header.
403: Forbidden Lack of user permissions to execute the operation.
404: Not Found The resource requested doesn’t exist.
405: Method Not Allowed The requested method can’t be applied to the URL.
406: Not Acceptable Accept header wasn’t found in the HTTP request or header contains content whose formatting or version isn’t supported by the API.
408: Request Timeout The server informs that the request is coming in slower than the server is prepared to wait. This means the server would like to terminate the connection.

This response is often used since some browsers, like Chrome, Firefox 27+, or IE9, use HTTP pre-connection to speed up navigation. Also, some servers take down the connection without sending this message.
409: Conflict Conflict in the execution of the request, such as creating an existing registry.
410: Gone This response is sent when the requested content was permanently deleted from the server, without a preset redirect address. If this error happens, any caches or links to this resource should be removed.

The HTTP specification describes that this code should be used for “limited promotional services”. APIs shouldn’t be made to indicate which resources were removed with this status code.
411: Length Required The server has rejected the request because the header Content-Length is undefined but required by the server.
414: URI Too Long The requested URI is larger than the server’s limits.
415: Unsupported Media Type The media format of the requested data is unsupported by the server, so the server rejects it.
416: Request Range Not Satisfiable The value specified by the Range header couldn’t be filled; it’s likely that it’s out of range of the target URI data.
426: Upgrade Required The server refuses to execute the requisition using the current protocol, but it’ll be ready to do so after the client updates to a different protocol. The server sends an Upgrade header response to indicate the required protocols.
429: Too Many Requests The request was temporarily rejected for exceeding operation limits. The client must wait until the moment defined in the X-Ratelimit-Reset and try again.
431: Request Header Fields Too Large The request’s headers are too long or too many cookies were sent in the request.
500: Internal Server Error Unintentional error, fault unidentified in the processing of the request.
501: Not Implemented The request method is unsupported by the server and can’t be modified. The only methods required for servers to support (and thus shouldn’t return this code) are GET and HEAD.
502: Bad Gateway This error response means that the server, working as a gateway in order to obtain a necessary response to manipulate the request, obtained an invalid response.
503: Service Unavailable The server isn’t ready to handle the request. Common causes are an overloaded server or a server under maintenance. Next to this response, a friendly page explaining the problem should be sent.

These responses should be used for temporary conditions and the Retry-After header should contain the estimated time to recover the service. The webmaster should also be careful with the caching related headers that are sent with this response, since these temporary condition responses shouldn’t normally be cached.
504: Gateway Timeout This error response is sent when the server is acting as a gateway and doesn’t obtain a response in time.
505: HTTP Version Not Supported The HTTP version used in the request isn’t supported by the server.

Didn’t find what you were looking for? Open a support ticket.