dean_02_164511
Mar 09, 2016Nimbostratus
Redirect match country and string not in url
I'm using a datagroup like below and the Irule like below. I'm trying to add a statement where if it matches the country australia and doesn't have pid=search in the url, redirect to x else redirect to y. I've tried writing the if statement like this
if
{ $redir ne "" } and { not ([HTTP::uri] contains "pid=search")}
and it barfs on me. Any help would be appreciated.
Irule
when HTTP_REQUEST {
set redir [class match -value -- [whereis [IP::client_addr]] contains country-redirect]
if { $redir ne "" } {
HTTP::redirect $redir
}
else {
HTTP::redirect "http://default.example.com/"
}
}
}`
Datagroup
ltm data-group internal country-redirect {
records {
AU {
data http://www.example1.com/
}
CR {
data http://www.example2.com/
}
MX {
data http://www.example2.com/
}
UK {
data http://www.example1.com/
}
US {
data http://www.example1.com/
}
}
type string
}