Forum Discussion

pratik_srivastava's avatar
pratik_srivastava
Icon for Nimbostratus rankNimbostratus
Apr 24, 2024

Geo Fence in ASM through irule for URI

I have ASM with Geo fence enabled where I added multiple country as denied but I want to add one URI from only one country rest all should denied for that uri /CKYC*. Apart from this uri all other uri should work as added geo fence.

 

tried below irule but its not working.

 

when HTTP_REQUEST {

        if { [string tolower [HTTP::uri]] starts_with "/CKYC*" && [whereis [IP::client_addr] country] ne "IN" } {
           drop }
}

  • You should really not use iRules that you not understand, but anyway:

    when HTTP_REQUEST priority 500 {
      if { ([string tolower [HTTP::path]] starts_with "/ckyc/") && ([whereis [IP::client_addr] country] ne "IN") } {
        drop
      }
    }

     

  • You force the HTTP::uri to be lower case and try to match with a upper case string, that can not work.

     

  • You should really not use iRules that you not understand, but anyway:

    when HTTP_REQUEST priority 500 {
      if { ([string tolower [HTTP::path]] starts_with "/ckyc/") && ([whereis [IP::client_addr] country] ne "IN") } {
        drop
      }
    }