Error Responses

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

When a user requests content from an edge application, Azion sends the request to the 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.

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.

Edge Application first stepsFirst steps
Customizing error pageHow to customize an error response page

The code Azion receives when connecting to the origin.

Defines the time in seconds that the error page will remain in cache before it’s refreshed.

Learn more about expiration settings

Path to the file (usually in HTML) with the content of the error page that will be delivered. This path is appended to your application’s domain. For example: /404.html.

Status code that will be delivered to the user instead of the original one. For example, you may define that the 404 code be delivered in response to a 403 error.

The origin in which the URI file is located. Can only be altered if a URI is provided. Must be configured using Origins.

Learn more about Origins
Status CodeDescription
400: Bad RequestRequest error caused by invalid parameters, missing required parameters, or others.
401: UnauthorizedError resulting from a lack of the Authentication HTTP header.
403: ForbiddenLack of user permissions to execute the operation.
404: Not FoundThe resource requested doesn’t exist.
405: Method Not AllowedThe requested method can’t be applied to the URL.
406: Not AcceptableAccept header wasn’t found in the HTTP request or header contains content whose formatting or version isn’t supported by the API.
408: Request TimeoutThe 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: ConflictConflict in the execution of the request, such as creating an existing registry.
410: GoneThis 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 RequiredThe server has rejected the request because the header Content-Length is undefined but required by the server.
414: URI Too LongThe requested URI is larger than the server’s limits.
415: Unsupported Media TypeThe media format of the requested data is unsupported by the server, so the server rejects it.
416: Request Range Not SatisfiableThe 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 RequiredThe 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 RequestsThe 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 LargeThe request’s headers are too long or too many cookies were sent in the request.
500: Internal Server ErrorUnintentional error, fault unidentified in the processing of the request.
501: Not ImplementedThe 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 GatewayThis 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 UnavailableThe 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 TimeoutThis error response is sent when the server is acting as a gateway and doesn’t obtain a response in time.
505: HTTP Version Not SupportedThe HTTP version used in the request isn’t supported by the server.