Forum Discussion

dem_23523's avatar
dem_23523
Icon for Nimbostratus rankNimbostratus
Sep 24, 2007

Convert rule from 4.x to 9.3

We have a simple rule in 4.5 that chooses a pool based on the URI (below). We're now upgrading to a new BigIP with 9.3, and I'm not familiar enough with the new syntax and options yet. Could someone suggest an efficient way to implement this rule?

 

 

if (http_uri starts_with "/isadmin/isreps") {

 

use pool reps-80

 

}

 

else if (http_uri starts_with "/isadmin/issf") {

 

use pool reps-80

 

}

 

else if (http_uri starts_with "/isadmin/issearch") {

 

use pool search-80

 

}

 

else if (http_uri starts_with "/isadmin/isutils") {

 

use pool utils-80

 

}

 

else if (http_uri starts_with "/isadmin/ismailrouting") {

 

use pool reps-80

 

}

 

else if (http_uri starts_with "/isadmin/isresplib") {

 

use pool nice-80

 

}

 

else if (http_uri starts_with "/isadmin/isagentconsole") {

 

use pool reps-80

 

}

 

else {

 

discard

 

}

 

2 Replies

  • You could try a switch:

    
    when HTTP_REQUEST {
      switch -glob [string tolower [HTTP::uri]] {
        "/isadmin/isreps/*" -
        "/isadmin/issf/*" -
        "/isadmin/ismailrouting/*" -
        "/isadmin/isagentconsole/*" { 
          pool reps-80 
        }    
        "/isadmin/issearch/*" { 
          pool search-80
        }    
        "/isadmin/isutils/*" { 
          pool utils-80
        }
        "/isadmin/isresplib/*" {
          pool nice-80
        }
        default {
          discard
        }
      }
    }

    Otherwise, if you want to maintain your if /elseif:

    
    when HTTP_REQUEST {
      if { [string tolower [HTTP::uri]] starts_with "/isadmin/isreps"} {
        pool reps-80
      } elseif { [string tolower [HTTP::uri]] starts_with "/isadmin/issf"} {
          pool reps-80
      } elseif {... } {
      } else { discard }
    }