Forum Discussion

tkrn_92652's avatar
tkrn_92652
Icon for Nimbostratus rankNimbostratus
Aug 26, 2011

Redirect to Pool based upon URL

The following is our problem. We have multiple customers on the same middleware. Each middleware operates on a separate instance/port so each customer has their own port for various reasons. How can I create a lookup table to a data based of the content based after the / in the URL Below gives you more a visual of what I am trying to do. ANY direction would be great. The F5's are brand new to us and trying to figure them out since no one here has experience with them. Thanks! http://virtual_ip/customer_a (F5) host1:8080 (JBOSS HTTP) host2:8080 (JBOSS HTTP) http://virtual_ip/customer_b (F5) host1:8081 (JBOSS HTTP) host2:8081 (JBOSS HTTP) http://virtual_ip/customer_c (F5) host1:8082 (JBOSS HTTP) host2:8082 (JBOSS HTTP)
  • Hi tkrn4,

    You can create separate pools for each set of servers (I am grouping them together so that the iRule makes more sense):

    pool.for.set.1.on.port.8080

    host1:8080 (JBOSS HTTP)

    host2:8080 (JBOSS HTTP)

    pool.for.set.1.on.port.8081

    host1:8081 (JBOSS HTTP)

    host2:8081 (JBOSS HTTP)

    pool.for.set.1.on.port.8082

    host1:8082 (JBOSS HTTP)

    host2:8082 (JBOSS HTTP)

    Then try this:

     
    when HTTP_REQUEST {
    switch -glob [string tolower [HTTP::uri]] {
    "/customer_a*" { pool pool.for.set.1.on.port.8080 }
    "/customer_b*" { pool pool.for.set.1.on.port.8081 }
    "/customer_c*" { pool pool.for.set.1.on.port.8082 }
    }
    }
    

    Note the Wildcard "*" is placed at the end because entries in a switch statement are literal.

    Hope this helps.