Hi - We have a site where the policy allows all URLs with * wildcard. We were recently asked to disable access to all URLs under a certain single directory except for a few URLs.
Since the “Disallow URLs” option doesn’t permit using WCs, I need a different solution.
Sadly I am still new to iRULES and I searched and found other solutions but not something as specific as this.
Any help would be greatly appreciated.
Thanks, Vered
Hi Guy,
Use this iRule :
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
"/root_dir/disallowed_dir1*" -
"/root_dir/disallowed_dir2*" -
"/root_dir/disallowed_dir3*"
{
drop the request or send code 403 to the user
drop
}
"/*"
{
do nothing for rest, send them to servers
}
}
}
or use that :
when HTTP_REQUEST {
if { ( [string tolower [HTTP::uri]] starts_with "/root_dir/disallowed_dir1" ) or ( [string tolower [HTTP::uri]] starts_with "/root_dir/disallowed_dir2" ) or ( [string tolower [HTTP::uri]] starts_with "/root_dir/disallowed_dir3" ) } {
drop
}
}