Jacquesvd_10578
Nov 30, 2015Nimbostratus
Geolocation iRule,
Hi guys, maybe someone can assist me regarding this irule. Our client wants to do Geo Location using this irule.
Any suggestions from your side, its not working, I have tried a couple of different things already.
Thank you, Jacques.
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] contains "marksandspencerme.com" && [HTTP::path] eq "/" }{
Parse the client IP from the CDN header
set client_ip [HTTP::header value "Client-IP"]
if { $client_ip eq "" }{
The header was empty/did not exist, so use the actual client IP
set client_ip [IP::client_addr]
}
set country [string tolower [whereis $client_ip abbrev]]
switch $country {
"JO" -
"EG" -
"BH" -
"KW" -
"QA" -
"OM" -
"LB" {
HTTP::redirect "http://www.marksandspencerme.com/-${country}"
}
default {
Redirect all others
HTTP::redirect "http://www.marksandspencerme.com/"
}
}
} else {
pool Pool_www.marksandspencerme.com_2.54_HTTP
}
}