Forum Discussion
MW1
Cirrus
Jan 08, 2009irule newbie - pointer please!
Hi all,
I'm very new to the irules and have alot to learn so apologies for asking something that I presume is very simple.
I need to restrict access to three URI's these are:
https://servername/admin/*
https://servername/user/*
https://servername/home/*
And block all other access (ie https://servername/admin/home allowed but not say https://servername/game)
I believe I will need to turn the request in to lowercase to avoid having to match the various cases ie https://servername/ADMIN/*. I've seen lots of post on matching a URI which contains a string but unsure on how to specify if it does not contain a string.
Can anyone point me in the right direction?
Thanks in advance
Matt
2 Replies
- James_Quinby_46Historic F5 AccountMatt -
This will do the trick:when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]] { "/user/*" - "/home/*" - "/admin/*" { pool apache } default { discard } } }
You'll want to change the name of the pool up there from 'apache' to whatever is appropriate. The two key bits in here are the 'switch' and 'string tolower'.
There's more info on switch here:
http://devcentral.f5.com/Default.aspx?tabid=63&articleType=ArticleView&articleId=244
...and on Tcl's string manipulation options here:
http://www.tcl.tk/man/tcl8.5/TclCmd/string.htmM49
One consideration might be the display of a 'sorry' page of some kind rather than just discarding the request silently.
(updated - tightened up the matching a little) - MW1
Cirrus
Works well. Thanks for the links - time for me to do some reading!
thanks again
Matt
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
