Forum Discussion
asabado
Nov 03, 2021Altocumulus
Geolocation redirection for external published DNS
I received a request to set up a redirection in the bigip depending on where the traffic is coming from. Basically when a customer accesses finder.abc.com(sample) from Spain, it gets redirected to ht...
spalande
Nov 03, 2021Nacreous
I see you were using SE for Sweden. So iRule would be following
when HTTP_REQUEST {
switch -glob [whereis [IP::client_addr]country] {
"ES"
{
HTTP::respond 301 Location "https://www.abc.com/es-es/home/servicepoints.html"
}
"SE"
{
HTTP::respond 301 Location "https://www.abc.com/se-se/home/servicepoints.html"
}
default {
HTTP::respond 301 Location "https://www.abc.com/home"
}
}
}
- asabadoNov 04, 2021AltocumulusThanks SanjayP, I did try out the irules but it didn’t seem to work.. ☹
- spalandeNov 04, 2021Nacreous
F5 has inbuilt gelocation database so this should work. I see there was 1 typo in iRule
(space between [IP::client_addr] country).
Please correct below and also enable some logging and provide the log output if still not working.
when HTTP_REQUEST { switch -glob [whereis [IP::client_addr] country] { "ES" { log local0. "ES IP match: [IP::client_addr]" HTTP::respond 301 Location "https://www.abc.com/es-es/home/servicepoints.html" } "SE" { log local0. "SE IP match: [IP::client_addr]" HTTP::respond 301 Location "https://www.abc.com/se-se/home/servicepoints.html" } default { log local0. "no match: [IP::client_addr]" HTTP::respond 301 Location "https://www.abc.com/home" } } }
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