Input parameters, Return values, Example – Brocade Virtual ADX OpenScript API Guide (Supporting ADX v03.1.00) User Manual
Page 71: Context

Brocade Virtual ADX OpenScript API Guide
59
53-1003243-01
Methods
5
Input Parameters
The following table contains the input values.
Return Values
None
Example
OS_HTTP_REQUEST::redirect("domain"=>$domain_value, "status-
code"=>$status_code, "url"=>$url_value, "port"=>$port_value)
Sends an redirect response to a client instead of forwarding the request to a server.
Context
This function can be called from an HTTP request event.
TABLE 59
Input Values
Name
Type
Description
$cookie_name
string
A string representing the name of the inserted cookie.
$domain
string
A string representing the domain attribute of the inserted cookie.
$path
string
A string representing the path attribute of the inserted cookie.
$age
integer
An integer representing the age attribute of the inserted cookie. The
unit is minute, for example 60 = 1 hour.
use OS_SLB;
use OS_HTTP_REQUEST;
sub HTTP_REQUEST {
# Get the Cookie from the request
my $hreq_cookie = OS_HTTP_REQUEST::cookie("ServerID");
if (defined $hreq_cookie) {
# forward to server with group id or server id identified by cookie
OS_SLB::forward($hreq_cookie);
} else {
#forward to server with group-id 10, insert set-cookie in response to client
OS_SLB::forward("10");
OS_HTTP_REQUEST::cookie_persist(
"name" =>"ServerID",
"domain" => "www.brocade.com",
"path" => "/",
"age" => "1024");
}
}