beautypg.com

Os_http_request::header($name, $value), Example, Context – Brocade Virtual ADX OpenScript API Guide (Supporting ADX v03.1.00) User Manual

Page 59: Usage, Input parameters, Return values

background image

Brocade Virtual ADX OpenScript API Guide

47

53-1003243-01

Methods

5

Example

OS_HTTP_REQUEST::header($name, $value)

Set the HTTP header value to the value specified in $name.

Context

HTTP request event. If called in the HTTP response context, undefined will be returned.

Usage

Can be used to replace an existing header or to insert a new header. If a header by the same name
as specified in $name exists, it will be overwritten. If multiple headers by the same name exist, the
first one will be overwritten. If there is no header by the same name, a new header will be inserted.

Input Parameters

The following table contains the input values.

Return Values

None

Example

TABLE 42

Input Values

Name

Type

Description

$name

string

A string representing the value
of the header name.

$value

string

A string representing the header
value.

use OS_SLB;

use OS_HTTP_REQUEST;

sub HTTP_REQUEST {

my $hostheader = OS_HTTP_REQUEST::header("Host");

if (defined $hostheader && $hostheader eq "www.abc.com") {

OS_SLB::forward(1);

} else {

OS_SLB::forward(2);

}

}

use OS_SLB;

use OS_HTTP_REQUEST;

sub HTTP_REQUEST {

OS_HTTP_REQUEST::header("Front-End-SSL","Off");

OS_SLB::forward(1);

}