Forum Discussion

bt_308832's avatar
bt_308832
Icon for Nimbostratus rankNimbostratus
Sep 11, 2017

BIGIP LTM GeoLocation Redirection

Hello,

I am somewhat new to the LTM still and learning the power of the tool. We are deploying a new virtual server which needs to detect and redirect various GeoLocations to a different URI, for example US redirects to https://example.com/US from https://example.com/. Based on the documentation I have designed this iRule:

when HTTP_REQUEST {
    set country [whereis [IP::client_addr] country]
    if {$country eq "US"}{
        HTTP::redirect "https://example.com/US"
        return
    } else if {$country eq "UK"}{
        HTTP::redirect "https://example.com/UK"
        return
    } else if {$country eq "CA"}{
        HTTP::redirect "https://example.com/CA"
        return
    } else {
        return
    }
}

My biggest concern is example.com returned correctly? Eg I can access example.com as long as I not in the US, CA or UK? Also I don't expect it but there shouldn't be any issues with looping, correct? IE WHEN HTTP_REQUEST is only checked once per request, and not again after redirecting.

Regards,

GM