Forum Discussion

richard_polyak's avatar
richard_polyak
Icon for Altocumulus rankAltocumulus
Oct 18, 2019

iRule 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 server pool?

 

Thx

Rich

4 Replies

  • 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
    }
  • Srini's avatar
    Srini
    Icon for Nimbostratus rankNimbostratus

    is the wildcard pool need to add under default pool?

     

    Thx

    Srini

  • Yes, the wildcard pool would be associated to the VIP in this instance

    • Srini's avatar
      Srini
      Icon for Nimbostratus rankNimbostratus

      Iaine,

       

      What is the case like , if we have two set of pools like few port and few url sending to poota and few prts and uri sending to poolb

       

      Thx

      Srini