Brocade Virtual ADX OpenScript API Guide (Supporting ADX v Manuel d'utilisateur Page 111

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 132
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 110
Brocade Virtual ADX OpenScript API Guide 99
53-1003243-01
Methods
7
Example
OS_SLB:: reply($data)
Causes the system send an error response to a client instead of forwarding a request to the server.
The error response can be specified in $data or the following default message will be sent: “HTTP/
1.1 403 Forbidden\r\nServer: HTTP Proxy/1.0\r\nConnection: Close\r\nContent-Length:
0\r\n\r\n"“
Context
This function can be called from HTTP request event.
Usage
Can be used to send an error page instead of load balancing traffic.
use OS_SLB;
use OS_HTTP_REQUEST;
use OS_HTTP_RESPONSE;
sub HTTP_REQUEST {
# Get the Cookie from the request
my $mycookie = OS_HTTP_REQUEST::cookie("ServerID");
#print "\n my cookie is: $mycookie\n";
if (defined $mycookie) {
$serverName = OS_SLB::persist_lookup("passive-persist", "$mycookie");
#print "\n\n\n &&& my server is: $serverName\n";
}
if (defined $serverName ) {
# forward to server based on passive cookie persistence
OS_SLB::persist("passive-persist","$mycookie");
} else {
OS_SLB::forward(10);
}
}
sub HTTP_RESPONSE {
$mySetCookie = OS_HTTP_RESPONSE::header("Set-Cookie");
#print "\n my set cookie is: $mySetCookie\n";
if ( $mySetCookie =~ m/.*ServerID=(\d+).*/ ) {
$cookie = $1;
#print "\n my cookie is: $cookie\n";
OS_SLB::passive_persist("add","$cookie");
}
}
Vue de la page 110
1 2 ... 106 107 108 109 110 111 112 113 114 115 116 ... 131 132

Commentaires sur ces manuels

Pas de commentaire