Forum Discussion
iRule to include / but not /*
A request has come in to create an iRule to filter traffic for /, /common, /etc, and /index.html to goto pool_A and all other content to goto pool_B. The issue I am running into is that once I include / it treats it as /*. Is there a way to include / with out it seeing it as / * ?
3 Replies
- Leonardo_39231
Nimbostratus
JeffM, Can you send us your code?
Thanks!
- Kevin_Stewart
Employee
Try this:
when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]] { "/" - "/common*" - "/etc*" - "/index.html*" { pool pool_A } default { pool pool_B } } }The -glob switch allows you to pattern match around the specified URIs. However, specifying the "/" URI without the * wildcard means exact match.
- Kevin_Stewart
Employee
Can you call a -glob for / and then have an else statment for the rest of the paths to be managed by a Data Group List. This would be safter for on going updates/maintenance.
Perhaps something like this might be better:
when HTTP_REQUEST { if { ( [HTTP::uri] equals "/" ) or ( [class match [string tolower [HTTP::uri]] starts_with my_uri_dg] ) } { pool pool_A } else { pool pool_B } }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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