beautypg.com

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

Page 60: Input parameters, Return values, Example, Usage

background image

48

Brocade Virtual ADX OpenScript API Guide

53-1003243-01

Methods

5

OS_HTTP_REQUEST::headers($name)

Gets all the HTTP headers with the same name as an array. This can be useful in a scenario where
the request is coming through multiple proxies and has many X-Forwarded-For headers.

Context

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

Input Parameters

The following table contains the input values.

Return Values

The following table contains the return values.

Example

OS_HTTP_REQUEST::host

Returns host specified in the HTTP request header if it exists, otherwise it will return NULL.

Context

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

Usage

Can be used to perform load-balancing based on the host value.

Input Parameters

None.

TABLE 43

Input Values

Name

Type

Description

$name

string

A string representing the value
of the header name.

TABLE 44

Return Values

Name

Type

Description

array

Headers with the same name
are returned as an array

use OS_HTTP_REQUEST;

sub HTTP_REQUEST{

@XForwardedForHeaders = OS_HTTP_REQUEST::headers("X-Forwarded-For");

}