Fortinet white logo
Fortinet white logo

Script Reference Guide

HTTP:header_remove2(header_name, countid)

HTTP:header_remove2(header_name, countid)

This function removes a certain header of a given name by referencing its unique position using the countid. The countid is an integer that specifies the header's serial number, typically obtained from HTTP:header_get_values().

Syntax

HTTP:header_remove2(header_name, countid);

Arguments

Name Description

Header_name

A string which specifies the header name.

Countid

A integer which specifies the header_name serial number

Events

Applicable in the following events:

  • BEFORE_AUTH

  • HTTP_REQUEST

  • HTTP_RESPONSE

  • WAF_REQUEST_ATTACK_DETECTED

  • WAF_REQUEST_BEFORE_SCAN

  • WAF_RESPONSE_ATTACK_DETECTED

  • WAF_RESPONSE_BEFORE_SCAN

Example

when HTTP_RESPONSE {
cookies=HTTP:header_get_values("Set-Cookie")
for k, v in pairs(cookies) do
debug("include cookie %s cnt %d\n", k, v)
end
if HTTP:header_remove2("Set-Cookie", 1) then
debug("remove 1st cookie\n")
end
}

Supported Version

FortiADC version 4.8.x and later.

HTTP:header_remove2(header_name, countid)

HTTP:header_remove2(header_name, countid)

This function removes a certain header of a given name by referencing its unique position using the countid. The countid is an integer that specifies the header's serial number, typically obtained from HTTP:header_get_values().

Syntax

HTTP:header_remove2(header_name, countid);

Arguments

Name Description

Header_name

A string which specifies the header name.

Countid

A integer which specifies the header_name serial number

Events

Applicable in the following events:

  • BEFORE_AUTH

  • HTTP_REQUEST

  • HTTP_RESPONSE

  • WAF_REQUEST_ATTACK_DETECTED

  • WAF_REQUEST_BEFORE_SCAN

  • WAF_RESPONSE_ATTACK_DETECTED

  • WAF_RESPONSE_BEFORE_SCAN

Example

when HTTP_RESPONSE {
cookies=HTTP:header_get_values("Set-Cookie")
for k, v in pairs(cookies) do
debug("include cookie %s cnt %d\n", k, v)
end
if HTTP:header_remove2("Set-Cookie", 1) then
debug("remove 1st cookie\n")
end
}

Supported Version

FortiADC version 4.8.x and later.