For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

eirikn's avatar
eirikn
Icon for Nimbostratus rankNimbostratus
Feb 17, 2016

URI pool selection using Data Groups (iRule)

Hi,

Im trying to use a data group for pool selection with certain URI's, but I cant get it to work.

This is my Data Group (only one entry atm)

ltm data-group internal /DMZ/dg_dmz_foobar.customer.com_app {
records {
    /test-uri-web {
        data pool_web_pool
    }
}
type string
}

This is my iRule:

when HTTP_REQUEST {

  log local0. "DMZ test request: [HTTP::uri] IP: [IP::remote_addr] port [TCP::local_port]"

set app_pool_destination [class match -value [string tolower [HTTP::uri]] starts_with dg_dmz_foobar.customer.com_app ]

if { $app_pool_destination ne ""} {
pool $app_pool_destination
nexthop 172.21.179.1
}

Expected result: User is browsing a host with a URI that starts with "/test-uri-web" The correct pool is selected acording to the data group value of that URI. There will be alot of these entry's, hence the datagroup.

Any help is appreciated!

2 Replies

  • mo_99289's avatar
    mo_99289
    Historic F5 Account
    didn't see any errors in your irule. if it didn't work, what unexpected result did you get?
  • eirikn's avatar
    eirikn
    Icon for Nimbostratus rankNimbostratus

    I actually got it working! I have some other stuff in the irule that was also hitting, and I forgot a "return" in the above if statement. Now with return the other part of the irule do not also hit :)

     

    Thanks for verifying my iRule though, helps to get some fresh eyes!