For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

SK_121993's avatar
SK_121993
Icon for Nimbostratus rankNimbostratus
Oct 25, 2013

Geolocation irule with HTTP response

I am trying to modify the following irule that is set to block connections from Germany, to display a message to the end user that thier connection is blocked. I added 'when http_request' command at the end of the irule below but it doesnt seem to go well with the switch command, something about not supported/invalid combination. Any help would be much appreciated. Thanks in advance.

when CLIENT_ACCEPTED {

set default_pool [LB::server pool] switch [whereis [IP::client_addr] country] {

DE {
    log local0. "Geo Client ([IP::client_addr]) detected as Germany" 
    reject 
} 
default { pool $default_pool   }

}

}

2 Replies

  • Richard__Harlan's avatar
    Richard__Harlan
    Historic F5 Account

    You can try something like this

    when HTTP_REQUEST {
    
    set default_pool [LB::server pool] switch [whereis [IP::client_addr] country]{
    
    DE {
    
    log local0. "Geo Client ([IP::client_addr]) detected as Germany" 
    HTTP::respond 500 content {
      
         
            Apology Page
         
         
            We are sorry, but you are not allowed access to this site from you geographic location
         
      
    }
    } 
        default { pool $default_pool   }
    
    }
    
    }
    
  • Thanks Richard! That compiles without any errors, tested OK.