|
|
Sample iRule This iRule exercises Servers Lookup to help locate users mail file across the domain. DominoServers is the server pool we are using in our sample on Big IP device. ##
when CLIENT_ACCEPTED {
#set the status - 'needs server' 1 or 0.
log local0. "got initial connect - needs a lookup."
set needs_server 0
}
when HTTP_REQUEST {
- capture original request - destined for a real server.
if { ([HTTP::uri]ends_with ".nsf") and not ([HTTP::uri] contains "names.nsf")}{
set original_request [HTTP::request]
set needs_server 1
set nsf "[substr [HTTP::uri] 1 ".nsf"].nsf"
HTTP::uri/iwaredir.nsf/ServersLookup?OpenForm&nsfpath=$nsf
} else {
set needs_server 0
}
- check to see if we need a server.Else, send to our dest. pool
if { $needs_server == 1 } {
#dummyServer is our ?mapping? server to query against.
It returns the header and its values.
pool DominoServers
} else {
pool DominoServers
}
}
when HTTP_RESPONSE {
if { $needs_server == 1 } {
set server_list [split [HTTP::headerX-Domino-ClusterServers], ,]
HTTP::collect[HTTP::headerContent-Length]
}
}
when HTTP_RESPONSE_DATA {
foreach {svr} $server_list {
if { "" ne $svr }{
set dest [findclass [string trim $svr] ::NSREPLICASERVERS " "]
log local0. "Servername is [string trim $svr]"
log local0. "$dest"
#TEST.ONE.TWO.COM 10.100.100.80:8080
#set node_addr [getfield [findclass $svr domino-servers " "] ":" 1]
#set node_port [getfield [findclass $svr domino-servers " "] ":" 2]
log local0. "server is: $node_addr on $node_port...issuing HTTP::collect"
if { [LB::status pool DominoServers member $dest 80 ] eq "up" } {
log local0. "Selecting $node_addr:$node_port"
pool DominoServers member $dest
HTTP::retry$original_request
break
}
}
}
set needs_server 0
}
- #
|
|