pvrobinsontx2_2
Nov 12, 2015Nimbostratus
iRule redirect based on uri or user-agent match logic.
Hello, looking for some direction here. I am trying create a rule which will match a specific set of uri and redirect if true to a prefered site and quit processing the irule. If the uri doesn't match, it will continue to the next match test for mobile in the header user-agent. If a match is found the redirect is to an other site.
Problem is, I can match the uri, but if it doesn't match the uri it doesn't seem to continue nor match when the user-agent is mobile.
Can someone tell me what I'm doing wrong here. I hope the formatting looks correct. Thanks.... ///pvr
when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]] {
"/about_news" -
"/*.pdf" {
HTTP::redirect "https://www.mysite.com[HTTP::uri]" }
}
switch -glob [string tolower [HTTP::header User-Agent]] {
"*mobile*" {
HTTP::redirect "https://www.myothersite.com[HTTP::uri]"
}
}
}