Forum Discussion
Yozzer
Jun 03, 2011Nimbostratus
Data Group List use in a switch
Hi
I have a Data Group list called allowed_urls that has a list of accepted urls which i want to use in an irule.
switch -glob [HTTP::uri] {
"*temp.txt" {
do stuff
}
"*users.txt" {
do stuff
How do i use Data Group lists in the example above?
Thanks
- hooleylistCirrostratusHi Yozzer,
- Colin_Walker_12Historic F5 AccountMore realistically what you want to do is set up an action for each file type. If that's the case, then make sure the action is associated with the file type in the data group.
when HTTP_REQUEST { set action [class match -value [string tolower [HTTP::uri]] equals allowed_urils] if {$action ne ""} do stuff $action } }
- Matt_Breedlove_NimbostratusI do something like this to do a two factor firewall type rule that includes a src ip whitelist chained to particular URI prefix's. I really like this and its not terrible to read/maintain and uses switch plus datagroups for the win
when HTTP_REQUEST { switch -glob [URI::decode [string tolower [HTTP::uri]]] { /customer1* { if { ([class match [IP::remote_addr] equals $::customer1_ip_whitelist]) } { return } } /customer2* { if { ([class match [IP::remote_addr] equals $::customer2_ip_whitelist]) } { return } } /customer3* { if { ([class match [IP::remote_addr] equals $::customer3_ip_whitelist]) } { return } } default { discard } } HTTP::redirect "http://srypage.acme.com/sorry/nac/?hn=[HTTP::host][HTTP::uri]" } I suppose to just check the URI against the datagroup instead of the src ip, it could be changed inline for each condition Hope this helps Thanks M
- YozzerNimbostratusThanks all,
- YozzerNimbostratusThe data group list isnt held in the irule but added or removed from the Data Group List tab (in the GUI under Local Traffic >> iRules >> Data Group List)
- nitassEmployeeas far as i know, i don't think it's possible.
- YozzerNimbostratusReally! Its not possible to use data group lists with an if statement?
- nitassEmployeeno, i mean i think it's not possible to use data group with switch.
- hooleylistCirrostratusThe datagroup will have various values that i want to test for in the url (i.e. a.txt, b.txt, c.txt, etc) and i want to perform actions when they are in the url.
- YozzerNimbostratusHi
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