F5 is upgrading its customer support chat feature on My.F5.com. Chat support will be unavailable from 6am-10am PST on 1/20/26. Refer to K000159584 for details.

Forum Discussion

Matthew_Hutchin's avatar
Matthew_Hutchin
Icon for Nimbostratus rankNimbostratus
Jul 28, 2015

iRule with Uppercase Letters in the URL

I am trying to force some letters in the URL to be uppercase. I have create the iRule but keep getting errors.

 

when HTTP_REQUEST { if { [HTTP::host] equals "test.xxxx.com" and [HTTP::uri] starts_with "/MyTest" } { pool pool_mytest.com--VIP247.100.TCP.443 } else { HTTP::redirect "https://test.xxx.com/MyTest/[HTTP::URI]" }

 

}

 

So what I need to do is, when anything called mytest comes in and in any format ie, mytest Mytest, mYtest, etc. I need to switch it to MyTest. Is that possible?

 

Thanks for any help in advance.

 

Matt

 

1 Reply

  • Try this:

    when HTTP_REQUEST {    
        if { ( [string tolower [HTTP::host]] equals "x.x.com" ) and ( [string tolower [HTTP::uri]] starts_with "/mytest" ) } {        
            if { not ( [HTTP::uri] starts_with "/MyTest" ) } {            
                HTTP::uri [string map -nocase {"/mytest" "/MyTest"} [HTTP::uri]]
            }
        } else {        
            HTTP::redirect "http://x.x.com/MyTest[HTTP::uri]"
        }
    }    
    

    Better to not do the pooling in the iRule if you can help it, as the status of the monitor status of the assigned pool directly affects the status of the VIP.