Forum Discussion

sec's avatar
sec
Icon for Nimbostratus rankNimbostratus
Apr 24, 2023

irule isn't working

I wanted to bypass a geolocation enfforcement for a specefic user agent using an Irule, but this irule didn't worked, and i'm still getting a block request.
u find bellow the irule:

when ASM_REQUEST_DONE {
  foreach {viol} [ASM::violation names] {
    if { $viol eq "Access from disallowed Geolocation" } {
      if { [HTTP::header "User-Agent"] eq "chrome" } {
        ASM::unblock
      }
    }
  }
}

any help please.

  • Are you specifically setting that user agent from a test client to be exactly "chrome"? If not, then that likely is not going to match anything, as the chrome user-agents are typically far more robust, like:

    Ex 1: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36
    
    Ex 2: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36

    If you are trying to match a stock user agent, you'll need to expand what you're trying to match and then maybe use the contains operator instead of eq. Also watch case sensitivity.