Forum Discussion
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
- Cory_50405
Noctilucent
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
Nimbostratus
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
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com