Forum Discussion
Stanislas_Piro2
Nov 12, 2015Cumulonimbus
Hi,
the irule may work when :
- URI doesn't match and user agent doesn't match
- URI match and user agent doesn't match
- URI doesn't match and user agent match
But the irule may cause a tcl error when both URI and user agent match
add a
return
command after each HTTP::redirect
to leave irule.
use
HTTP::path
instead of HTTP::uri
in switch... HTTP::uri
may contain query string which can be dynamic.
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::path]] {
"/about_news" -
"*.pdf" {
HTTP::redirect "https://www.mysite.com[HTTP::uri]"
return
}
default {
if {[string tolower [HTTP::header User-Agent]] contains "mobile"} {
HTTP::redirect "https://www.myothersite.com[HTTP::uri]"
return
}
}
}
}