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

Pirlo's avatar
Pirlo
Icon for Nimbostratus rankNimbostratus
Mar 14, 2014

URI Not Triggering Redirect properly

Ok i have fought with this for about 4 hours now. I am focusing on this portion of the rule below

 

if { [string tolower [HTTP::uri]] contains "/en-us/home.html?verifyPasswordToken=&token="} { HTTP::redirect https://mobile-preprod.mysite.com/directory/pages/mobile/password-reset.jsp?token=$query

 

In the rule below the /en-us/home.html?verifyPasswordToken=&token= trigger in the URI is not redirecting me.

 

It is triggering on the last uri redirect containing .html since it matches.

 

I can get the log statements to progress thru HTTP Request, Matched User Agent, and then Redirect to M -but instead of Redirect to M I am expecting Redirect to Pass Reset

 

Am I blind? Did I miss something obvious here?

 

when HTTP_REQUEST { set query [HTTP::query] log "HttpRequest" if { [class match -- [string tolower [HTTP::header "User-Agent"]] contains mobile_redirected_devices] } { log "Matched User Agent" if { [string tolower [HTTP::host]] contains "www" && ([string tolower [HTTP::uri]] contains "par.html") } { pool WWW-PreProd-Pool-80 log "Sent to PreProd Pool" } if { [string tolower [HTTP::uri]] contains "favorites.html" } { HTTP::redirect https://www.myothersite.com/en-us/mobile/cmobile.html log "Redirect to Prod CMobile" } if { [string tolower [HTTP::uri]] contains "/en-us/home.html?verifyPasswordToken=&token="} { HTTP::redirect https://mobile-preprod.mysite.com/directory/pages/mobile/password-reset.jsp?token=$query log "Redirect to Pass Reset" } if { [string tolower [HTTP::uri]] contains ".html" } {

 

HTTP::redirect http://m.mysite.com log "Redirect to M" } }

 

}

 

2 Replies

  • You have capital letters in your match string, and you are converting the URI to all lowercase before attempting a match. Hence, it will never match. Change it to this:

     

    if { [string tolower [HTTP::uri]] contains "/en-us/home.html?verifypasswordtoken=&token="}

     

  • Pirlo's avatar
    Pirlo
    Icon for Nimbostratus rankNimbostratus

    Reformatting for thread. Sorry.

     

    when HTTP_REQUEST {
    set query [HTTP::query]
    log "HttpRequest" 
    if { [class match -- [string tolower [HTTP::header "User-Agent"]] contains mobile_redirected_devices] } { 
    log "Matched User Agent" 
    if { [string tolower [HTTP::host]] contains "www" && ([string tolower [HTTP::uri]] contains "par.html") } { 
    pool WWW-PreProd-Pool-80 
    log "Sent to PreProd Pool" 
    } 
    if { [string tolower [HTTP::uri]] contains "favorites.html" } { 
    HTTP::redirect https://www.myothersite.com/en-us/mobile/cmobile.html 
    log "Redirect to Prod CMobile" 
    } 
    if { [string tolower [HTTP::uri]] contains "/en-us/home.html?verifyPasswordToken=&token="} { 
    HTTP::redirect https://mobile-preprod.mysite.com/directory/pages/mobile/password-reset.jsp?token=$query 
    log "Redirect to Pass Reset" 
    } 
    if { [string tolower [HTTP::uri]] contains ".html" } { 
    HTTP::redirect http://m.mysite.com log "Redirect to M" 
    } 
    } 
    }
    
    Code