Forum Discussion
iaine
Oct 21, 2019Nacreous
Hi
Try something like this as a starter
when HTTP_REQUEST {
#Check to see if the DataGroup matches a URI call
set svr_port [class match -value -- [HTTP::uri] starts_with pool_port_forward]
#Check to see if a LB decision has already been made for this connection
if { [LB::server addr] != "" }{
#Check to see the LB port matches the DataGroup entry
if {[LB::server port] != $svr_port } {
#If the port and DataGroup dont match, remove the serverside connection and re-load-balance
LB::detach
}
}
if {$svr_port eq ""}{
#DataGroup doesn't match the URI, drop the connection
#or do something else here
drop
}
}
when LB_SELECTED {
#A new LB decision has been made, check to see if the DataGroup has fired
if {$svr_port != ""}{
#The DataGroup URI matches, check to see if the ports match
if {[LB::server port] != $svr_port } {
#Send the traffic to the DataGroup Port
LB::reselect node [LB::server addr] $svr_port
}
}
}
ltm data-group internal /Common/pool_port_forward {
records {
/home {
data 8080
}
/image {
data 8081
}
/static {
data 8082
}
}
type string
}