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

Cody_Conklin_17's avatar
Cody_Conklin_17
Icon for Nimbostratus rankNimbostratus
Aug 11, 2005

iRule variable match is case sensitive

I have an iRule that behaves normally:

 

 

if (http_uri starts_with "/authentication") {

 

use pool IIS_Pool_80

 

}

 

else if (http_uri starts_with "/certapp") {

 

use pool IIS_Pool_80

 

}

 

else if (http_uri starts_with "/lms") {

 

use pool IIS_Pool_80

 

}

 

else {

 

use pool beta.xyz.com

 

}

 

 

 

Unfortunately, it does not work if a user accidentally goes to the URI "/Authentication". How do a make the variable match be case insensitive? Regardless of whether a user types "/Authentication" or "/authentication", it should direct to IIS_Pool_80.

14 Replies

  • hoolio's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    Hi cachis,

     

     

    Are you running 4.x or 9.x/10.x? This thread is for 4.x. The "when HTTP_REQUEST {... format is for 9.x/10.x.

     

     

    Aaron
  • Hi thanks for the reply

     

    I am running 9.x

     

    Will this irule be ok?

     

    class allowed_uris {

     

    "/abc"

     

    "/xyz"

     

    "/efg" note efg is not in use at this time

     

    }

     

    rule r1 {

     

    when HTTP_REQUEST {

     

    if(tolower(http_uri) starts_with one of allowed_uris) {

     

    if { [active_members ECS-Pool] >= 1 } {

     

    pool ECS-Pool

     

    }

     

    }

     

    }

     

    }

     

    Thanks for your help

     

    I just like the way this was done and I did not want to use the if statements and as I need to ability to comment in and out "allowed_uris" i thought this was good

     

    Thanks in advance

     

    Chris
  • hoolio's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    It's close, but not exactly in 9.x format. You can use:

     
     when HTTP_REQUEST { 
      
         Check if requested URI starts with an allowed URI 
        if {[matchclass [string tolower [HTTP::uri]] starts_with $::allowed_uris]}{ 
      
           if { [active_members ECS-Pool] >= 1 } { 
              pool ECS-Pool 
           } else { 
      
               Take some action? 
           } 
        } else { 
            Take some action? 
        } 
     } 
     

    Aaron
  • Hi Aaron

     

     

    Thanks for rehashing this into v9.x code.

     

    I feel more comfortable with what you just wrote as its more familiar with what im used to seeing

     

     

    Thanks for your help. Ill put this into the Lab environment tonight and test it out.

     

     

    Chris