Hi Sanalbabu,
I asume that this allow/blocking functionality would be needed for a virtual server serving a specific websites, right? If so, then use the snippet below as a starting point...
when CLIENT_ACCEPTED {
if { ( [IP::addr [IP::client_addr] equals 10.0.0.0/8] ) or
( [IP::addr [IP::client_addr] equals 172.16.0.0/12] ) or
( [IP::addr [IP::client_addr] equals 192.168.0.0/16] ) } then {
set my_trusted_clients 1
} else {
set my_trusted_clients 0
}
}
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] equals "www.abc.com" } then {
set low_uri [string tolower [HTTP::uri]]
if { ( $my_trusted_clients ) and
(( $low_uri starts_with "/xyz/ccc" ) or
( $low_uri starts_with "/xyz/yyy" ) or
( $low_uri starts_with "/xyz/ppp" ) or
( $low_uri starts_with "/xyz/ooo" )) } then {
You may insert additional iRule code here, to handle request to the explicitly allowed sub-sites
} elseif { $low_uri starts_with "/xyz" } then {
Insert your block code here, to handle the blocked requests
Below are some examples...
1.) Sending a redirect
HTTP::redirect "http://www.somesite.com/errorpage.html"
2.) Sending a errorpage
HTTP::respond 403 content "Access denied"
} else {
You may insert additional iRule code here, to handle request to other sub-sites
}
} else {
You may insert additional iRule code here, to handle request to other sites
}
}
Cheers, Kai