Fortinet white logo
Fortinet white logo

Script Reference Guide

HTTP:respond(t)

HTTP:respond(t)

Allows you to return a customized page and send out an HTTP response directly from FortiADC.

Syntax

HTTP:respond(t);

Arguments

Name Description

t

A table which will give the response code and content.

Events

Applicable in the following events:

  • HTTP_REQUEST

  • HTTP_DATA_REQUEST

  • HTTP_RESPONSE supported since V7.2.4 and V7.4.1.

Example

when HTTP_REQUEST {
tt={}
tt["code"] = 200;
tt["content"] = "HTTP/1.1 200 OK\r\nConnection: close\r\nContent-Type: text/plain\r\n\r\nXXXXX Test Page XXXXXXX";
status = HTTP:respond(tt);
debug("HTTP_respond() status: %s\n", status);
}

Supported Version

FortiADC version 5.2.x and later.

HTTP:respond(t)

HTTP:respond(t)

Allows you to return a customized page and send out an HTTP response directly from FortiADC.

Syntax

HTTP:respond(t);

Arguments

Name Description

t

A table which will give the response code and content.

Events

Applicable in the following events:

  • HTTP_REQUEST

  • HTTP_DATA_REQUEST

  • HTTP_RESPONSE supported since V7.2.4 and V7.4.1.

Example

when HTTP_REQUEST {
tt={}
tt["code"] = 200;
tt["content"] = "HTTP/1.1 200 OK\r\nConnection: close\r\nContent-Type: text/plain\r\n\r\nXXXXX Test Page XXXXXXX";
status = HTTP:respond(tt);
debug("HTTP_respond() status: %s\n", status);
}

Supported Version

FortiADC version 5.2.x and later.