Fortinet white logo
Fortinet white logo

Script Reference Guide

HTTP:cookie(t)

HTTP:cookie(t)

Allows you to get/set cookie value and cookie attribute, remove a whole cookie, get the whole cookie in HTTP_RESPONSE, and insert a new cookie.

Syntax

HTTP:cookie(t);

t = {}

t[“name”] = “name”

t[“parameter”] = {can be value, cookie, path, domain, expires, secure, maxage, max-age, httponly, version, port, attrname }

t[“value”] = value

t[“case_sensitive”] = {0 or 1}

t[“action”] = {can be get, set, remove, insert}

ret = HTTP:cookie(t) --return is true if succeed or false if failed

Arguments

Name Description

t

A table which specifies cookie name, parameter, action.

Events

Applicable in the following events:

  • HTTP_REQUEST

  • HTTP_RESPONSE

Example

when HTTP_REQUEST {
t={};
t["name"]="test"
t["parameter"]="value";--value, cookie, path, domain, expires,  secure, maxage, max-age,  httponly,  version, port, attrname,
t["action"]="get"--get, set, remove, insert
ret = HTTP:cookie(t)
if ret then
debug("get cookie value succeed %s\n",ret);
else
debug("get cookie value failed\n");
end
}

Note:

  • name: specify cookie name

  • parameter: specify cookie value and attribute, including value, cookie, path, domain, expires, secure, maxage, max-age, httponly, version, port

  • action: can be get, set, remove, insert

Supported Version

FortiADC version 5.0.x and later.

HTTP:cookie(t)

HTTP:cookie(t)

Allows you to get/set cookie value and cookie attribute, remove a whole cookie, get the whole cookie in HTTP_RESPONSE, and insert a new cookie.

Syntax

HTTP:cookie(t);

t = {}

t[“name”] = “name”

t[“parameter”] = {can be value, cookie, path, domain, expires, secure, maxage, max-age, httponly, version, port, attrname }

t[“value”] = value

t[“case_sensitive”] = {0 or 1}

t[“action”] = {can be get, set, remove, insert}

ret = HTTP:cookie(t) --return is true if succeed or false if failed

Arguments

Name Description

t

A table which specifies cookie name, parameter, action.

Events

Applicable in the following events:

  • HTTP_REQUEST

  • HTTP_RESPONSE

Example

when HTTP_REQUEST {
t={};
t["name"]="test"
t["parameter"]="value";--value, cookie, path, domain, expires,  secure, maxage, max-age,  httponly,  version, port, attrname,
t["action"]="get"--get, set, remove, insert
ret = HTTP:cookie(t)
if ret then
debug("get cookie value succeed %s\n",ret);
else
debug("get cookie value failed\n");
end
}

Note:

  • name: specify cookie name

  • parameter: specify cookie value and attribute, including value, cookie, path, domain, expires, secure, maxage, max-age, httponly, version, port

  • action: can be get, set, remove, insert

Supported Version

FortiADC version 5.0.x and later.