HTTP:respond_errorfile(filename)
Allows the HTTP to respond with a specified error file. This function returns Boolean true if successful otherwise, returns Boolean false.
Syntax
HTTP:respond_errorfile(filename);
Arguments
|
Parameter |
Description |
|---|---|
| filename |
A Lua string as the file name of the error file. The maximum length of a file name in Linux is 255 characters, including the file extension. Ensure the file name is valid, such as “403.html” or “path1/index.html”. If the file name is invalid, the API will still return as true, but the response will be 404 "Not Found". This parameter is mandatory. |
Events
Applicable in the HTTP_REQUEST event.
Example
when HTTP_REQUEST {
uri = HTTP:uri_get()
filename = nil
if uri=="/home/root" then
filename = "403.html"
…
if filename ~= nil then
HTTP:respond_errorfile(filename)
end
}
Supported Version
FortiADC version 7.6.1 and later.