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]
...
Stanislas_Piro2
Jun 20, 2018Cumulonimbus
Your code is from this link where Leonardo answered.
Does it mean this code never worked since september?
If the redirect is on the same server but to a subdirectory, redirect to a relative URL instead of absolute URL
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] contains "example.com" && [HTTP::path] eq "/" }{
set country [whereis [IP::client_addr] country]
switch $country {
"US" -
"UK" -
"CA" - { HTTP::redirect "/${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