Forum Discussion
Richard_Kim_270
Nimbostratus
Jan 17, 2007Two iRules one Virtual server
Ok so I have a iRule that does the following:
when CLIENT_ACCEPTED {
set default_pool [LB::server pool]
}
when HTTP_REQUEST {
if{ [matchclass [string tolower [HTTP::uri]] starts_with $::Report_strings_matchclass] } {
pool custom_pool
}
else {
pool $default_pool
}
}
this works great but now I have to add another rule where the following strings match exactly then send it to another node otherwise send it to pool custom_pool
/company/SmartImaging/ProcessRequest.aspx?MethodName=UploadImages
/company/SmartImaging/ProcessRequest.aspx?MethodName=SaveImages
Is it more efficient to seperate these as two seperate iRules and bind them to a virtual server or combine these two into on iRule? Would switch globbing be more efficient for the second requirement or should I stick with Data Groups?
- Richard_Kim_270
Nimbostratus
- In my opinion, it's best to make a single purpose iRule unless you have common logic that you need to apply across multiple virtual servers. When you have more than one iRule associated with a single virtual, unless you set the priority, it's you'll likely have to worry about the order the iRules were processed and that could in some situations cause logic errors.
when CLIENT_ACCEPTED { set default_pool [LB::server pool] } when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]] { "report_string_1*" - "report_string_2*" - "report_string_n*" { pool custom_pool } "*image_string_1*" - "*image_string_2*" - "*image_string_n*" { pool image_pool } default { pool $default_pool } } }
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