Custom Error Webpage for Avi-Generated Responses
This article describes how one can generate one’s own custom error page, with application-specific content.
Currently, Avi Vantage can generate custom responses from policy, DataScript, or a POOL_DOWN action. Other than this, there are cases where we are unable to communicate with a back-end server (for instance 502), where we respond back to the client with a hard-coded page (non-custom). Customers occasionally prefer to generate their own custom error page, so that it doesn’t have “Avi” on the page, but rather some application-specific message.
How it Works
With Avi Vantage 17.1.3, a new DataScript event named RESP_FAILED is supported. It triggers when any error/timeout happens up to the point that a valid response header is received from the server and forwarded to client. For instance:
- TCP/SSL connect/handshake to server fails
- Request proxy/send to server times out
- No response or partial response headers or bad response headers from the server
- Server resets connection while the Avi SE is waiting for the server to respond
A DataScript attached to the
RESP_FAILED event is executed. Example functions exposed to the script are
avi.http.redirect(), and (the newly created)
avi.http.internal_status(). The user can use these to customize response for the different types of failures, log the reason in Avi Logs, etc. Refer to the below Knowledge Base articles: