Fortinet white logo
Fortinet white logo

Script Reference Guide

HTTP:redirect(“url”, …)

HTTP:redirect(“url”, …)

Redirects an HTTP request or response to the specified URL.

Syntax

HTTP:redirect(“url”, …);

Arguments

Name Description

url

A string which specifies the redirect URL.

Events

Applicable in the following events:

  • HTTP_REQUEST

  • HTTP_DATA_REQUEST

  • HTTP_RESPONSE

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.

HTTP:redirect(“url”, …)

HTTP:redirect(“url”, …)

Redirects an HTTP request or response to the specified URL.

Syntax

HTTP:redirect(“url”, …);

Arguments

Name Description

url

A string which specifies the redirect URL.

Events

Applicable in the following events:

  • HTTP_REQUEST

  • HTTP_DATA_REQUEST

  • HTTP_RESPONSE

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.