Forum Discussion

Anish_Srivastav's avatar
Anish_Srivastav
Icon for Nimbostratus rankNimbostratus
Dec 16, 2010

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] country] is FR,GB,ES etc then HTTP_X_FORWARDED_GEO = EU else it will be US or NULL value.

 

 

Can someone please help me in achieving this using an iRule or any other method which can work?

 

 

Thanks in advance

 

 

Anish

 

 

  • 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
  • Hi Anish,

     

     

    After reading some internal docs, I think that the EULA for Quova's GeoIP data restricts any type of use where the GeoIP info is passed off of LTM. So to follow the licensing for Quova data on LTM, you couldn't use the above iRule or any other that transmits the GeoIP data to non-LTM hosts.

     

     

    If you want more info on this, you could contact your local F5 SE or partner.

     

     

    Sorry for any confusion,

     

    Aaron