Forum Discussion
richard_polyak
Altocumulus
Oct 18, 2019iRule or policy on a port 80 VS, that will match a dataGroup and send to specific port on a wildcard pool?
Good afternoon, Looking to create a port 80 Virtual Server, that will match a uri in a data group that will map it to a specific port like 8888, 8899, 8900 and then send the uri request to a wildcard...
iaine
Nacreous
Oct 21, 2019Hi
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
}Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects