Error Responses
Customize the error page an Application on API v3 serves for each client or server error status code it receives from the origin.
Error Responses is a Feature of Applications on API v3: the error page settings that customize the page a user receives for a status code from the origin. On API v4, Custom Pages takes its place.
When a user requests content from an Application, Azion sends the request to the origin servers. The origin answers with an HTTP status code, which says whether the request was completed.
HTTP status codes are three-digit numbers, grouped into five categories:
- Informational responses (1xx): the connection status or the progress before the request completes.
- Successful responses (2xx): the origin received, understood, accepted, and processed the request.
- Redirection messages (3xx): the request needs a redirect to be fulfilled.
- Client error responses (4xx): the request could not be completed because of an apparent error on the client side.
- Server error responses (5xx): the server cannot process the request.
For more information on HTTP statuses, refer to the specifications on HTTP status codes.
Error Responses customizes how an Application handles client error (4xx) and server error (5xx) responses. When a request reaches a URL that the origin cannot find, or the server cannot respond, the user is redirected to a custom error page, and its content can be cached.
Status Code
The code that Azion receives when it connects to the origin.
Error Caching TTL
The time, in seconds, that the error page stays in cache before Azion refreshes it. For more information on expiration settings, refer to Cache settings.
URI
The path to the file, usually HTML, that holds the content of the error page. Azion appends this path to the domain of the Application, for example, /404.html.
Custom Status Code
The status code the user receives instead of the original one. For example, a page can deliver the 404 code in response to a 403 error.
Set Origin
The origin that holds the URI file. You can change it only after you enter a URI, and you configure the origin in Origins. For more information, refer to Origins.
Available error status codes
Error Responses accepts these client error and server error status codes:
| Status Code | Description |
|---|---|
| 400: Bad Request | A request error, such as invalid parameters or missing required parameters. |
| 401: Unauthorized | The request lacks the Authentication HTTP header. |
| 403: Forbidden | The user lacks permission to run the operation. |
| 404: Not Found | The requested resource does not exist. |
| 405: Method Not Allowed | The requested method cannot be applied to the URL. |
| 406: Not Acceptable | The Accept header is missing, or asks for a format or version the API does not support. |
| 408: Request Timeout | The request arrives slower than the server is prepared to wait, so the server wants to end the connection. |
| 409: Conflict | The request conflicts during execution, such as creating a record that already exists. |
| 410: Gone | The requested content was permanently deleted from the server, with no preset redirect address. |
| 411: Length Required | The server rejected the request because the required Content-Length header is undefined. |
| 414: URI Too Long | The requested URI is longer than the server’s limits. |
| 415: Unsupported Media Type | The server does not support the media format of the requested data, so it rejects it. |
| 416: Request Range Not Satisfiable | The server cannot fill the Range header value, likely out of range of the target URI data. |
| 426: Upgrade Required | The server refuses the request on the current protocol and accepts it after the client changes protocol. |
| 429: Too Many Requests | The request was rejected for a time because it exceeded operation limits. |
| 431: Request Header Fields Too Large | The request headers are too long, or the request sends too many cookies. |
| 500: Internal Server Error | An unintentional, unidentified fault occurred while the request was processed. |
| 501: Not Implemented | The server does not support the request method, and the method cannot be modified. |
| 502: Bad Gateway | The server, working as a gateway to get a response the request needs, received an invalid response. |
| 503: Service Unavailable | The server is not ready to handle the request, often because it is overloaded or under maintenance. |
| 504: Gateway Timeout | The server, acting as a gateway, does not receive a response in time. |
| 505: HTTP Version Not Supported | The server does not support the HTTP version used in the request. |
Six of the codes carry more detail:
- 408: this response is common because some browsers, such as Chrome, Firefox 27+, and IE9, use HTTP pre-connection to speed up navigation. Some servers also end the connection without sending this message.
- 410: when this error happens, caches and links to the resource should be removed. The HTTP specification describes this code for “limited promotional services”, and an API should not use it to say which resources were removed.
- 426: the server sends an
Upgradeheader in the response to name the protocols it requires. - 429: the client must wait until the time in the
X-Ratelimit-Resetheader before it tries again. - 501: the only methods a server must support are
GETandHEAD, so a server does not return this code for them. - 503: send a page that explains the problem with this response. The code is for temporary conditions, and the
Retry-Afterheader should carry the estimated time to recover the service. Take care with the cache headers sent with this response, because a temporary condition should not normally be cached.