Forum Discussion

breddy_11660's avatar
Icon for Nimbostratus rankNimbostratus
Jun 15, 2012

irules to redirect based on simple pay-per-click 'tags'

We have a pair of BIG-IP F5 Load Balancers, running 10x+, which direct traffic between two web farms.




Farm A) handles default traffic, 404s, etc


Farm B) handles a more limited set of CMS based pages




We have a request to support a PPC campaign, based on a limited set of URL characteristics,


along the lines of:











Some example URL's would resemble the following






The hope is that a *pattern* iRule can be created which will allow ANY request with *RefID* or *TrkNum* to be redirected from Webserver Farm A to Webserver Farm B.




Initially this doesn't look feasible however, as the iRule logic apparently will only use a single wildcard, making *pattern* type wildcard matching not possible.




Can anyone confirm, or point to other options ?








5 Replies

  • You can check the URI in the request using [HTTP::uri] and use switch to handle multiple patterns:

    when HTTP_REQUEST {
       switch -glob [HTTP::uri] {
          "*RefID*" -
          "*TrkNum*" {
              Matched RefID or TrkNum
          default {
              No match

  • Also, if the strings you want to check for are in the query string you could change [HTTP::uri] to [HTTP::query] to be more precise.



  • That's good to hear. I was informed by our datacenter that *wildcard*-pattern-*wildcard* type iRules were just not possible, since only the first wildcard would be read.
  • switch -glob uses the same matching logic as TCL string match so you can definitely use multiple wildcards and character classes:



    % string match {*2*4*} 123456789





    % string match {*[0-9]*} abc5def





    % string match {*2*5[6-8]*9} 123456789





  • That worked, by the way. Have successfully enabled the listed rules, and PPC links are working correctly now.