Forum Discussion
Anish_Srivastav
Dec 16, 2010Nimbostratus
GeoIP-Quova header help
Greetings!
I want to have a custom generated HTTP header i.e. HTTP_X_FORWARDED_GEO which will hold the value "EU" for any country in the European union i.e. if [whereis [IP::client_addr] co...
hooleylist
Dec 17, 2010Cirrostratus
Hi Anish,
You can use an iRule like this to look up the country for a client IP and insert it into a header:
when CLIENT_ACCEPTED {
Look up the client IP in the GeoIP database and get the country
set country [whereis [IP:client_addr] country]
For EU countries, set the value to EU
switch $country {
"FR" -
"GB" -
"ES" -
"IE" {
For these countries, set the country to EU
set country "EU"
}
}
}
when HTTP_REQUEST {
Replace (or insert if not there already) the country in a custom header
HTTP::header replace HTTP_X_FORWARDED_GEO value $country
}
Aaron
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