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

sidiov's avatar
sidiov
Icon for Nimbostratus rankNimbostratus
Mar 17, 2009

Redirecting specific java strings in uri

I have a redirection query that currently redirects the root page based on the browser type.

 
 when HTTP_REQUEST { 
 if { [HTTP::path] equals "/" }{ 
  if { [HTTP::header "User-Agent"] contains "soviet" } 
 {HTTP::redirect "http://soviet.com/"} 
     } 
 } 
 

this works just fine.

However now I have to pick a specific instance where a jquery is passed in the uri to NOT redirect. I tried the following, but it prevented all access to the site from the browser.

 
 when HTTP_REQUEST { 
 if { [HTTP::path] equals "/" }{ 
           if { not [string tolower [HTTP::uri]] starts_with "/?user=soviet" }{ 
     if { [HTTP::header "User-Agent"] contains "soviet" } 
     {HTTP::redirect "http://soviet.com/"} 
        } 
     } 
 } 
 

What would the correct way of doing this be?

2 Replies

  • hoolio's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    I think the problem is with the logical not. If you wrap what you want to negate in parentheses does it work?

     
     when HTTP_REQUEST { 
        if { [HTTP::path] equals "/" }{ 
           if { not ([string tolower [HTTP::query]] starts_with "user=soviet") }{ 
              if { [HTTP::header "User-Agent"] contains "soviet" }{ 
                 HTTP::redirect "http://soviet.com/" 
              } 
           } 
        } 
     } 
     

    Aaron