IP Address based iRule

Im trying to block

---[HTTP::uri]] contains “/_grid/print/print_data.aspx”

from everyone with an IP not 10.0.0.0/8

I have one iRule.

when HTTP_REQUEST {

if { [string tolower [HTTP::uri]] contains “/_grid/print/print_data.aspx” } {

HTTP::redirect “http://google.com”

}

}

I know that I can have the below somewhere but its just not adding up..

“inside network”-> if { [IP::addr [IP::client_addr]/8 equals 10.0.0.0] }

thanks for any direction.

BIG-IP 9.4.1 Build 29.2

R.

Like this?

when HTTP_REQUEST { 
    if { [string tolower [HTTP::path]] ends_with "/_grid/print/print_data.aspx" and (not ([IP::addr [IP::client_addr]/8 equals 10.0.0.0]))} { 
       HTTP::redirect "http://google.com" 
    } 
 }

Some of the parentheses might not be needed.

Aaron

Perfection!!!

I dropped it in and everything worked 100%… thanks for the help!

Ryan

Sharp looking rule. Simple, efficient, and a cool example of how to use iRules for something I don’t see every day in the forums. Dig it.

Colin