DataScript: avi.http.response
DataScript
Function | avi.http.response (status, {headers}, body) |
Description |
Responds to the HTTP request with a custom HTTP response. |
Events |
HTTP_REQ HTTP_RESP LB_DONE |
Parameter |
status is used to specify the HTTP status code. See list for supported status codes below. Optional headers are used to specify a table to add headers in the response. The default content-type used is “text/plain”. Hence if the body is some other mime-type such as “text/html”, the headers parameter should be used to specify the corresponding content-type. Optional body flag is a string used to specify a custom HTTP response body. To learn how to insert a graphic in a returned page, see Returning an Image from a DataScript. |
Supported Status Codes |
200 HTTP Ok 202 Accepted 301 Moved Permanently 302 Found 303 See Other 307 Temporary Redirect 400 Bad Request 401 Unauthorized 403 Forbidden 404 Not Found 405 Method Not Allowed 413 Request Entity Too Large 414 Request-URI Too Long 429 Too Many Requests 451 Unavailable For Legal Reasons 500 Internal Server Error 501 Not Implemented 502 Bad Gateway 503 Service Unavailable 504 Gateway Timeout |
Returns |
No return value |
Example |
Prevent shell shock attack and notify the attacker with a friendly message.
|