Forum Discussion

roblof_255673's avatar
roblof_255673
Icon for Nimbostratus rankNimbostratus
Mar 23, 2016

Redirect traffic to a specific node in a pool depending on URL using iRules

Two months on the meter with F5 and now I need some help with iRules.

 

I want "www.domain.com/x/login" to be directed to two specific servers test1 and test2 in pool "tool-test" and "www.domain.com/y/login" to be directed to two other servers test3 and test4 in the same pool "tool-test"

 

when HTTP_REQUEST { switch -glob [string tolower [HTTP::path]] { "/x"-"/y" { pool pool tool-test } default { pool tool-test } } }

 

I don't know if it's even possible to do it when the servers are in the same pool. BIG-IP version 11.6.0

 

Thanks Robert

 

5 Replies

  • Josiah_39459's avatar
    Josiah_39459
    Historic F5 Account

    It's possible with an elaborate irule using the pool member command and programming your own load balancing algorithm--but then you are losing pretty much all the benefit of having them in a pool in the first place (and you could just as easily use the node command).

     

    Why not have two pools?

     

    • roblof_255673's avatar
      roblof_255673
      Icon for Nimbostratus rankNimbostratus
      I have specified the default pool "tool-test" to the virtual server as resource. Is it possible to have several pools to a virtual server
    • Josiah_39459's avatar
      Josiah_39459
      Historic F5 Account
      Yep. In an irule you can send traffic to pools which aren't attached to the vip.
    • roblof_255673's avatar
      roblof_255673
      Icon for Nimbostratus rankNimbostratus
      Need some more help on this matter. I have now divided the four servers I have into two pools. tool-uat and tool-oslc. tool-uat is the default pool that is connected to the virtual-server. Domain "https://uat.domain.com/uat1/login" is working which the servers in pool tool-uat Domain "https://uat.domain.com/uat1/oslc/login is not working which is the servers on pool tool-oslc I have created an iRule that is attched to the virtual-server when HTTP_REQUEST { switch [string tolower [HTTP::uri]] { "oslc*" { pool tool-oslc } default_pool { pool tool-uat } } } Have also tried: when HTTP_REQUEST { set uri [string tolower [HTTP::uri]] { switch -glob $uri { "/oslc/login/" { pool tool-oslc } default { pool tool-uat } } }