Forum Discussion
veredgf_96123
Nimbostratus
Feb 15, 2018irule - allow only a few URLs under a directory
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
- Faruk_AYDIN
Altostratus
Hi Guy,
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 } }
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects