HTTP:redirect(str_url_withreplace [, parameter, ...])
Redirects an HTTP request or response to the specified URL.
Syntax
HTTP:redirect(str_url_withreplace [, parameter, ...]);
Arguments
| Name | Description |
|---|---|
|
str_url_withreplace |
A string defining the destination URL. This string can contain C-style format specifiers (e.g., %s, %d) that will be replaced by subsequent parameters.parameter: Optional. One or more variables or literal values used to replace the format specifiers found in str_url_withreplace. The number of parameters must match the number of specifiers. |
Events
Applicable in the following events:
-
BEFORE_AUTH
-
HTTP_DATA_REQUEST
-
HTTP_REQUEST
-
HTTP_RESPONSE
-
WAF_REQUEST_ATTACK_DETECTED
-
WAF_REQUEST_BEFORE_SCAN
-
WAF_RESPONSE_ATTACK_DETECTED
-
WAF_RESPONSE_BEFORE_SCAN
Note: Cannot be used in HTTP_DATA_RESPONSE.
Example
when HTTP_REQUEST {
Host = HTTP:header_get_value("host")
Path = HTTP:path_get()
HTTP:redirect("https://%s%s", Host, Path);
}
Supported Version
FortiADC version 4.3.x and later.