Forum Discussion

saidshow_251381's avatar
saidshow_251381
Icon for Cirrostratus rankCirrostratus
Jul 26, 2017

Geoblock exception based on user agent

Hi,

 

We have Geo-blocking enabled for one of our apps and want to allow access from a third party tool that has a very specific user agent. Is it possible to allow requests from a geo blocked location when the user agent matches a particular string?

 

Thank you.

 

1 Reply

  • You can do it with an iRule which checks the User-Agent Header to be the one you want to white-list and then unblocks that request using ASM::unblock

    Here is a sample iRule (replace 'My Magic User Agent' with User-Agent you need):

    when ASM_REQUEST_DONE {
      foreach {viol} [ASM::violation names] {
        if { $viol eq "VIOLATION_ILLEGAL_GEOLOCATION" } {
          if { [HTTP::header "USER-AGENT"] contains "My Magic User Agent" } {
             ASM::unblock
        }     
        }
      }
    
    }
    

    Hope this helps,

    Sam

    P.S. Remember to enable 'Trigger ASM iRule Events' in your policy properties!