Forum Discussion

Ken_Mitchell_13's avatar
Ken_Mitchell_13
Icon for Nimbostratus rankNimbostratus
Apr 03, 2007

Translate uri and balance to different pools?

I have a production application which resides at a uri of /my/application.htm among many nodes in pool “default.” The url for this is abc.def.com.

 

I have other pools which use the same uri, but are used for testing and development.

 

Testing should be reached by the URL abc.def.com/testing, and the F5 LTM should use pool “test” and the uri /my/application.htm to load balance.

 

Development should reached by the URL abc.def.com/dev, and the F5 LTM should use pool “dev” and the uri /my/application.htm to load balance.

 

 

I have been unable to use HTTP::redirect and the “pool” syntax in the same "if" or "switch" statement. How do I solve the above problem?
  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    If all you're trying to do is use the incoming URI to choose the pool to load balance to, and then update the URI, the code should be pretty straight forward.

     

     

    Something like:

     

     

    
    when HTTP_REQUEST {
      if { [HTTP::uri] starts_with "/testing" } {
        set myPool "test"
      } elseif { [HTTP::uri] starts_with "/dev" } {
        set myPool "dev"
      }
      HTTP::uri "/my/application.htm"
      pool $myPool
    }

     

     

    HTH,

     

    Colin
  • Thanks! I incorporated that syntax into a switch statement, just setting myuri and mypool variables in the switch as needed. Then, at the end simply said:

     

    HTTP::uri $myuri

     

    pool $mypool

     

     

    Worked beautifully.