HTTP:redirect_t(t)
Redirects an HTTP request or response to the URL specified in the table.
Supports multiple redirect, same as HTTP:redirect_with_cookie().
Syntax
HTTP:redirect_t(t);
Arguments
| Name | Description |
|---|---|
|
t |
A table that defines the code, redirect url, and cookie. |
Events
Applicable in the following events:
-
HTTP_REQUEST
-
HTTP_DATA_REQUEST
-
HTTP_RESPONSE
Note: Cannot be used in HTTP_DATA_RESPONSE.
Example
when HTTP_RESPONSE{
a={} --initialize a table
a["code"]=303;
a["url"]="www.example.com"
a["cookie"]="test:server"
HTTP:redirect_t(a)
debug("redirected\n")
}
Note:
-
If the code is not set, then the default code in the HTTP redirect response will be 302.
-
If the URL is missing in the input table, then a log will be generated.
Supported Version
FortiADC version 4.8.x and later.