Forum Discussion
john_waterworth
Nimbostratus
Oct 06, 2010is it possible to consolidated multiple irules ito one irule
is it possible to consolidate the following irules into one irule
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] contains "/mtp/" } {
drop
}
}
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] contains "/console/" } {
drop
}
}
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] contains "/mtpadm/" } {
drop
}
}
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] contains "/remote-deploy/" } {
drop
}
}
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] contains "/juddi/" } {
drop
}
}
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] contains "/activeemg/" } {
drop
}
}
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] contains "/console-base/" } {
drop
}
}
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] contains "/debug-views/" } {
drop
}
}
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] contains "/plan-creator/" } {
drop
}
}
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] contains "/monitoring/" } {
drop
}
}
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] contains "/plugin/" } {
drop
}
}
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] contains "/system-database/" } {
drop
}
}
2 Replies
- Ben_95489
Nimbostratus
Hey John,
This should definitely be possible. The switch operator ( http://devcentral.f5.com/wiki/default.aspx/iRules/switch.html ) is probably the best candidate for doing this. If these don't currently all apply to the same virtual server, there may be an argument for not gluing them all together for performance reasons. For example, if one of these URIs exists only on one virtual server, why make every virtual server parse the rule for it? If that isn't an issue, however, what you are probably looking for is something like this:
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
"*/plan-creator/*" { drop }
"*/mtp/*" { drop }
et cetera
et cetera
}
}
Hope this helps!
// Ben - john_waterworth
Nimbostratus
Thanks Ben. i will give it a try
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
