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]
...
Stanislas_Piro2
Cumulonimbus
Jun 20, 2018Your 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}" }
}
}
}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
