Forum Discussion

Richard_K_20123's avatar
Richard_K_20123
Icon for Nimbostratus rankNimbostratus
Apr 13, 2016

Insert a spcific area in hearder rather than the true location

I would like to say that I am not well at F5 iRule so I would like to get some advise from you guys.

 

I am testing with enabling/disabling certain feature of webpages when a user is coming from a specific geographic location. For the test purpose, the testers want me to get a specific area like New south Wales inserted into header rather tan the true location.

 

At this moment, the following irule is configured on the dev F5.

 

when HTTP_REQUEST { HTTP::header insert X-UBET-Region [whereis [IP::client_addr] state]

 

Could you please give me a right direction on this request? Thank you in advance.

 

1 Reply

  • Hi

    Rather than do a GEO lookup, you could just add the header using whatever value you like, so something like

    when HTTP_REQUEST { 
    HTTP::header insert X-UBET-Region "My Region"
    }
    

    Or, if you wanted to be a bit more granular, you could look for some other information, such as the Dev team's source IP/VLAN and then only apply the updated header.

    when HTTP_REQUEST {
    
    if { [IP::addr [IP::client_addr] equals 10.10.10.0/24] } {
    HTTP::header insert X-UBET-Region "My Region"
    } else {
    HTTP::header insert X-UBET-Region [whereis [IP::client_addr] state]
    }
    }