Forum Discussion
bt_308832
Jun 20, 2018Nimbostratus
Detect 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
Jun 20, 2018Cirrostratus
try
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}"
}
}
}
}
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