Forum Discussion
jona187_168823
Nimbostratus
Mar 04, 2015iRule to set country code for IP
I need help setting the country code for a specific IP to test out website functionality
I want to create an irule to set the country code to a specific country, fo ex like CN
What is the k...
Hannes_Rapp
Nimbostratus
Mar 09, 2015Perhaps the safest option would be expanding your IF condition with an OR statement (using the [IP::client_addr] function, as recommended by Michael J)
when HTTP_REQUEST {
if { ([whereis [IP::client_addr]] == "CN") || ([IP::client_addr] == "Your.IP.Address" ) } {
do some stuff...
}
}Alternatively, you should be able to set the system-provided 'whereis' variable to your own value. Have not tested, please use with caution
when HTTP_REQUEST {
if { [IP::client_addr] == "Your.IP.Address"} {
set [whereis [IP::client_addr]] "CN"
For verification, tail /var/log/ltm as you implement the changes
log local0. "IP: [IP::client_addr]; Country Code: [whereis [IP::client_addr]]"
}
Geo-location iRule continues...
}- Hannes_RappMar 09, 2015
Nimbostratus
Please note there's an error, you should use "[whereis [IP::client_addr] country]" everywhere, instead of "[whereis [IP::client_addr]]" - nitassMar 09, 2015
Employee
is set [whereis [IP::client_addr] country] "CN" typo?
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
