Forum Discussion
irule or policy to match url and then update pool members port
Hi Richard,
the LB_SELECTED event is probably not needed to make it work.
AFAIK you cant select a pool member on a port which is not configured in the pool. You may use the "node" command instead to connect to a IP::Addr of your choice. But keep in mind that this would bypass any LB decissions and health monitor checks for a given port on a given pool member...
when CLIENT_ACCEPTED {
# Select a pool member based on LB balacing mode
set lb_node [lindex [LB::select] 3]
}
when HTTP_REQUEST {
#Check to see if the DataGroup matches a URI call
set svr_port [class match -value -- [HTTP::uri] starts_with dg_testdg]
if { $svr_port eq "" } then {
#DataGroup doesn't match the URI, drop the connection
#or do something else here
reject
return
}
#Check to see if a LB decision has already been made for this connection
if { [LB::server port] eq $svr_port } then {
# Correct port is already selected. Do nothing and return...
return
} elseif { ( [LB::server port] ne "" )
and ( [LB::server port] ne $svr_port ) } then {
LB::detach
}
node $lb_node $svr_port
}
But this is somehow a mess. It would be far more elegant to create a pool for each port number, apply proper Health Monitoring to the pools and then used the iRule below...
when HTTP_REQUEST {
#Check to see if the DataGroup matches a URI call
set svr_port [class match -value -- [HTTP::uri] starts_with dg_testdg]
if { $svr_port eq "" } then {
#DataGroup doesn't match the URI, drop the connection
#or do something else here
reject
return
}
pool "pool_test.domain.com_$svr_port"
}
You just have to make sure that the Data-Group port number are alligning with the naming of the pool objects...
Cheers, Kai
Kal -
So you still feel using a pool for each port would be best approach? Query do you know how this would work in an AS3 template, as this is how it will be deployed and utilized? I don't mind if that is the approach as I am moving to a self-service model, so they would require to manage the pools themselves, but I am concerned this could overwhelm the BIG-IQ AS3 templete process?
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com