Forum Discussion
bt_308832
Nimbostratus
Jun 20, 2018Detect Geo Location With iRule and Redirect
Hello,
I have this iRule:
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] contains "example.com" && [HTTP::path] eq "/" }{
set country [whereis [IP::client_addr] country]
...
Anesh
Cirrostratus
Jun 20, 2018try
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] equals "www.example.com" && [HTTP::path] eq "/" }{
set client_ip [IP::client_addr]
set country [string tolower [whereis $client_ip country]]
switch $country {
"us" -
"uk" -
"ca" {
HTTP::redirect "https://example.com/${country}"
}
}
}
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects
