Forum Discussion

ch4f5_166880's avatar
ch4f5_166880
Icon for Nimbostratus rankNimbostratus
Oct 22, 2014

having /%23/path - /#/uri issue matching irule

Our developers have decided to user //uri for the match case, in the f5 it shows up as just / with no //uri. I've tried uri decoding, string map, no luck. Here's my latest attempt to catch the / at the beginning of the uri..

when HTTP_REQUEST {

if { [URI::decode [HTTP::uri]] starts_with "/" } {

   switch -exact [string tolower [HTTP::uri]] {
     "//a" { HTTP::redirect "http://www.Aredirect.com}
     "//b" { HTTP::redirect "http://www.Bredirect.com}
 "//c" { HTTP::redirect "http://www.Credirect.com}
   }

} }

    • ch4f5_166880's avatar
      ch4f5_166880
      Icon for Nimbostratus rankNimbostratus
      I think you're right! The developers couldn't filter/see the / character in Apache either. One of the engineer mentioned that no rewrite parsing engine will be able to filter on this character (f5, apache, IIS, etc).
    • ch4f5_166880's avatar
      ch4f5_166880
      Icon for Nimbostratus rankNimbostratus
      I think you're right! The developers couldn't filter/see the / character in Apache either. One of the engineer mentioned that no rewrite parsing engine will be able to filter on this character (f5, apache, IIS, etc).
  • Ok, so does that mean the only option here is for them to recode the URL to use any other character then / to get the irule redirect to work?

     

  • I tried uri decoding another way, same blank "/" result..

    when HTTP_REQUEST { log local0. "irule_blah [HTTP::uri] triggered!"

    set tmpUri [string tolower [HTTP::uri]]
    set uri [URI::decode $tmpUri]
    
    log local0. "HTTP uri decoded to $uri triggered!"
    
    log local0. "HTTP uri = [HTTP::uri] triggered!"
    switch -glob $uri {
         "//a" { HTTP::redirect "http://www.Aredirect.com}
         "//b" { HTTP::redirect "http://www.Bredirect.com}
         "//c" { HTTP::redirect "http://www.Credirect.com}
    

    }

    info tmm7[23795]: Rule /blah : irule_blah / triggered! info tmm7[23795]: Rule /blah : HTTP uri decoded to / triggered! info tmm7[23795]: Rule /blah : HTTP uri = / triggered!

  • Many characters have special meaning in TCL. Try using curly braces instead of double quotes.

    if { [HTTP::uri] starts_with {/} } {
      switch [HTTP::uri] {
         {//a} { HTTP::redirect "http://www.Aredirect.com"}
         {//b} { HTTP::redirect "http://www.Bredirect.com"}
         {//c} { HTTP::redirect "http://www.Credirect.com"}
       }
    }
    
  • No luck, but thanks for the suggestion! I logged a case with f5 support as well. This may be a no go. I've done URL decoding before, but never with a sound in the beginning of the path like this. If I change it to any other character, it works fine!