Forum Discussion

Eduardo_SCR_151's avatar
Eduardo_SCR_151
Icon for Nimbostratus rankNimbostratus
Jul 11, 2016

setting pool and tcp port via iRule

Hello. I have to create an iRule to do the following:

  1. I have a pool listening all tcp ports
  2. depending on the hostname, I need to send the connection to the servers in a different tcp port

One option, is to create one pool for each tcp port. But I would prefer, if possible, to set the pool listenning in all tcp ports, and then modify the port via iRule. This would be :

when HTTP_REQUEST {
switch -glob [string tolower [HTTP::host]] {
  "hostname1" {
       pool genericpool
       set port 100 }                                                                                                   
  "hostname2" {
       pool genericpool
       set port 200 }                                                                                                                                             
}
}

My main concern is about the sentence "set port". I was not able to find examples like this, I only found examples specifying pool-member-port.

Thanks, Eduardo.

1 Reply

  • Your question has been answered here: https://devcentral.f5.com/questions/changing-destination-pool-tcp-port-via-irules

     

    I would recommend creating multiple pools if your intention is to use just 2-3 different pools. However, if it is more in number or if you expect the number to grow, the example link should be useful.