Forum Discussion
Hille_de_Graaf_
Nimbostratus
Mar 25, 2008Simplify iRule
I have an iRule which would look at the content of the HTTP-header and loadbalance on behalve of that content.
Is there a more efficient way to build an iRule with the same results as the example below?
when HTTP_REQUEST {
if { [HTTP::uri] ends_with "ACCBPMv1" } {
pool xml-fw
} elseif { [HTTP::uri] ends_with "ACCTVIv1" } {
pool xml-fw
} elseif { [HTTP::uri] ends_with "ACCDVSv1" } {
pool xml-fw
} elseif { [HTTP::uri] ends_with "BPMv1" } {
pool xml-fw
} elseif { [HTTP::uri] ends_with "TVIv1" } {
pool xml-fw
} elseif { [HTTP::uri] ends_with "DVSv1" } {
pool xml-fw
} else {
pool ws-accxml
}
}
Regards,
Hille
2 Replies
- The_Bhattman
Nimbostratus
There are 2 ways I can see this work.when HTTP_REQUEST { switch [HTTP::uri] { "ACCBPMv1" {pool xml-fw } "ACCTVIv1" { pool xml-fw } "ACCTDSv1" { pool xml-fw } "BPMv1" { pool xml-fw } "TVIv1" { pool xml-fw } "DVSv1" { pool xml-fw } } }
when HTTP_REQUEST { switch -glob [HTTP::uri] { "ACC*" {pool xml-fw } "BPMv1" { pool xml-fw } "TVIv1" { pool xml-fw } "DVSv1" { pool xml-fw } } }
when HTTP_REQUEST { switch -glob [HTTP::uri] { "*v1" {pool xml-fw } } }
class uricontains { "ACCBPMv2" "ACCBPMv1" "ACCTVIv1" "ACCTDSv1" "BPMv1" "TVIv1" "DVSv1" } when HTTP_REQUEST { if { [matchclass [HTTP::uri] contains $::uricontains] } { pool xml-fw } else {pool xml-accxml } }
- Nicolas_Menant
Employee
Hi,
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