Forum Discussion
irule or policy to match url and then update pool members port
I was thinking of somthing line the following:
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]
#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::detach
LB::reselect node [LB::server addr] $svr_port
}
}
}
ltm data-group internal dg_testdg {
records {
/testprt/data/sap/chartofaccounts/glaccount\* {
data 34562
}
/testprt/data/nop/companycodes {
data 34561
}
/testprt/data/sap/wbse/search {
data 34561
}
/testprt/data/timekeeper/timecard/gettimecard {
data 34563
}
/testprt/data/timekeeper/unionmasterdata/contract {
data 34562
}
/testprt/data/timekeeper/unionmasterdata/jobcode {
data 34562
}
}
type string
}
- Kai_WilkeJan 18, 2023MVP
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
- richard_polyakFeb 24, 2023Altocumulus
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