value lookup
1 TopiciRule to define pool names based on URI mapped to a value in a data group.
I have a need to configure a iRule that can take a portion of the URI and search a data group and then take the mapped value and use that in the creation of the pool name. I am not a coder and I thought this would be a fairly easy iRule to find an example but as it turned out, I could not find anything very close. I was able to "Frankenstein" a iRule together from multiple other iRule examples and I was finally able to get this working. The thing that I am most worried about however is the efficiency of my code and am I making the proper use of the "matchclass" and "class match". I took many of these examples from iRules that were written for V9 and V10 and I wonder if there is a more efficient/elegant way to write this iRule for what I am trying to accomplish. Thank you in advance. when HTTP_REQUEST { if {[matchclass [string tolower [HTTP::path]] contains APP_DEV_uri_pool_map]} { set poolName "APP-BW-DEV-[class match -value [string tolower [HTTP::path]] contains APP_DEV_uri_pool_map]" pool $poolName if { $poolName equals "APP-BW-DEV-" } { log -noname local0.warn "uri-map-lookup-failed: from: [IP::remote_addr] for request: [HTTP::host] [HTTP::uri]" HTTP::respond 404 content { Not found Not found The requested page or resource was not found. } } } } Data Group APP_DEV_uri_pool_map /pub_lead2lease := LEAD2LEASE-9001 /pub_omsorderservicev1 := OMS-ORDERS-9002 /pub_productservicev1 := OMS-PRODUCTS-9003394Views0likes1Comment