Forum Discussion

amit_128525's avatar
amit_128525
Icon for Nimbostratus rankNimbostratus
Dec 05, 2013

irule rejecting all the request

we have created below irule in which we want to allow one ip address to access the normal website all other request should be rejected but when we place below rule url is not opening even for 10.1.1.1

 

when HTTP_REQUEST { if { [HTTP::host] contains "a.b.com" } { switch [IP::addr [IP::client_addr] mask 255.255.255.255] { "10.1.1.1" { pool Pool_A_Prod } default { reject } } } }

 

3 Replies

  • We use something similar to the below to block access to some sites, unless you are aplpying the iRule to multiple VIP's or have multiple DNS names pointing to the same VIP I wouldn't bother looking in the host header it adds needless complication.

        set clientip [IP::client_addr]
    
    if { [IP::addr 10.1.1.1/32 equals $clientip] } {
    
        pool pool_a
    }
    else {
        reject
    }
    
  • Your problem was trying to use a switch statement with [IP::addr [IP::client_addr] mask 255.255.255.255] - it doesn't work like that. Use the syntax lapayne suggests.