Forum Discussion
SanjayP
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.. ☹
- SanjayPNov 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" } } }