Forum Discussion

Kevin_Hickman_1's avatar
Kevin_Hickman_1
Icon for Nimbostratus rankNimbostratus
Aug 08, 2005

Mixed case compares ?

What is the best syntax to compare uri's in a mixed case environment.

 

 

I want to use something along the lines of:

 

 

if (http_uri starts_with "/cccard/public/en/ApplyNow")

 

redirect to "https:/%h/%u"

 

 

Where the A in apply and N in now could be either upper or lower case.

 

 

Thanks.

4 Replies

  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    Kphi,

     

     

    What distribution of the 4.x code are you running on your BigIP? The practices for this vary slightly depending on which release you're on.

     

     

    Thanks,

     

    -Colin
  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    Kphi,

    To do this in the 4.6.1 and later branch, you'd use the "tolower" command, which we made available as of 4.6.1.

    We have a solution about it on askf5.com here:

    Click here http://tech.f5.com/home/bigip/solutions/lb/sol2796.html

    Basically, the syntax looks like this:

    
    rule WhateverCase {
      if (tolower(http_uri) ends_with "jpg") {
        use pool web
      } else {
        use pool web1
      }
    }

    Whenever performing a string comparison while using the tolower command, it will treat everything as lowercase, so you should be set.

    Hope this helps,

    -Colin